Simple interpreter for Pascal language built using Python.
This interpreter was built following the Let's Build a Simple Interpreter
tutorial.
This is an experiment project, the aim is have fun and learn more about compilers & interpreters.
This interpreter can either process a file or run in the REPL mode.
Basically, we have to follow the steps bellow:
- Clone this repository
- Install all dependencies (see setup)
- Process a Pascal file (see process a file)
- REPL version (see REPL version)
To properly run this interpreter, we should install the dependencies:
make setup
We have two kinds of tests implemented: unit tests and behaviour tests. We can run the tests with the following commands:
make tests # Run both unit and behaviour tests
make unit-tests
make behaviour-tests
We can run the application and see the web version of this interpreter. Just have to run the command bellow:
make run <filename>.pas
This interpreter also has a REPL mode that can be enable with the following command:
make run-repl
To run this interpreter inside docker, we have to follow the commands bellow:
-
Install docker
-
Build simple interpreter image
docker build -t simple-interpreter
-
Run commands using docker
docker run -i -v `pwd`:/simple-interpreter make tests