A compiler and interpreter for the minimal programming language PL/0 written in C++.
The parser uses the grammar from Wikipedia
The compiler targets a custom instruction set. Therefore the project also builds an assembler and vm to execute the generated code.
To compile the code yourself, execute the following steps:
- Navigate to the projects root
- Create a new folder (e.g. Debug) with
mkdir Debug && cd Debug
- Within this folder, issue the command
cmake .. -DCMAKE_BUILD_TYPE=Release
- Now you have to decide which target to build
pl0
: this only builds the interpreterpl0c
: this builds the compiler, assembler and vmcompile_and_run_example
: this is a handy target, if you want to execute the generated asm code directly. This target assumes you have a file calledexample.pl0
in the projects root. To use another file set the cmake variabelEXAMPLE_FILE
to the filepath you want to use
- Now you can run all build executables located in the
./bin
folder - All executables take a file as their first command line argument. Image you have a
hello.pl0
file, then you would invoke the compiler, interpreter, assembler, or vm with<executable> hello