The goal of this project is to implement a Lex/Yacc based compiler for the Monga programming language - a simple procedural language - that generates LLVM code from Monga source files.
This is a project for the Compilers course (INF1715) at PUC-Rio.
- C11 compliant compiler
- GNU Flex + Bison (scanner and parser generation);
- CMake 3.18 or higher (build system generator);
- Python (unit testing);
- LLVM + Clang (assembly of LLVM generated files);
Use the following command while in the root of the repository to setup the build system:
cmake -S . -B bin
Then, cd onto bin and call make.
This will generate binaries for monrt (the Monga runtime library), libmonga (the Monga compiler library), monga (the Monga compiler executable) and montests (the Monga Unit test suite) inside their respective folders within bin/src.
This mode will generate an LLVM file for every specified Monga source file.
monga -o <programOutputPath> <mongaSource1>[, <otherMongaSource>...]The token dumping mode will read an input file and dump all tokens scanned by the Lexical Analyser.
monga -l <sourceFile>This mode will dump the Abstract Syntax Tree of an input source file in XML format after parsing it.
monga -p <sourceFile>This mode will perform semantic analysis on Monga source files, outputting errors if they occur.
monga -s <sourceFile1> [<sourceFilen>...]- Fix issues with Mon_Dict
- Replace several uses of vectors with hashtables (once Mon_Dict works properly)