This is a just-for-fun hobby implementation of the PL/0 programming language. This implementation can parse and evaluate PL/0 source files. It is not a full compiler implementation.
This project uses Conan and CMake. Run the following to perform a release build:
conan install --build=missing
cmake --preset conan-default
cmake --build --preset conan-releaseOnce built, you can run the executable directly from the build directory like so:
./build/src/Release/pl0program = block ".";
block = [ "const" identifier "=" number { "," identifier "=" number } ";" ]
[ "var" identifier { "," identifier } ";" ]
{ "procedure" identifier ";" block ";" } statement ;
statement = [ identifier ":=" expression
| "call" expression
| "?" identifier
| "!" expression
| "begin" statement { ";" statement } "end"
| "if" condition "then" statement
| "while" condition "do" statement ] ;
condition = "odd" expression
| expression ( "=" | "#" | "<" | "<=" | ">" | ">=" ) expression ;
expression = [ "+" | "-" ] term { ( "+" | "-" ) term } ;
term = factor { ( "*" | "/" ) factor } ;
factor = identifier | number | "(" expression ")" ;
number = ? [0-9]+ ? ;
identifier = ? [A-Za-z_][A-Za-z0-9_]* ? ;Note
This implementation treats keywords as case-insensitive and identifiers as case-sensitive.