A simple compiler for the Portugol language. Project developed by Ricardo Oliveira and João Oliveira.
- Lexical analyzer using Flex
- Semantic analyzer using Bison
- AST Generation in C
- Intermediate code generation using LLVM
- Code optimization
- Final machine code generation
- Possibly redoing the entire thing...
- To generate the compiler simply run the
build.sh
file (please remember that you need to have flex, bison and llvm installed to run this file). Afterwards simply run the binary file with te file to be compiled as its argument. - The compiler also comes with a test suite to assess its current status. The tests can be run by executing the
test.sh
file. - There is also a
run.sh
file which generates the compiler (by running build.sh) and compiles a file called test.portugol to LLVM IR (module.bc) and prints it to the console. Afterwards it compiles that into a program called prog and runs it. It's merely to make the testing process quicker.
Warning
This project is currently on hold until i finish my Compilers course. Afterwards i might come back to it, since it was really just a learning project and not really something properly functional 😅