A compiler for a custom procedural language, generating machine code for a dedicated virtual machine.
- Lexical Analysis: Tokenization of source code using Sly Lex-Yacc.
- Syntax Parsing: Grammar validation and AST construction.
- Symbol Management: Symbol table for tracking variables and scope.
- Machine Code Generation: Translation of high-level constructs into low-level instructions.
| Component | Technology |
|---|---|
| Language | Python 3.6+ |
| Parser Generator | SLY (Sly Lex-Yacc) |
| Architecture | Modular Compiler Design |
| Target | Virtual Machine Assembly |
-
Environment Setup: Ensure you have Python 3 installed.
apt install python3
-
Dependencies: Install the required
slylibrary:pip3 install sly
-
Compilation: To compile a source file, provide the input and output paths:
python3 src/kompilator.py tests/exampleA.imp output.mr
-
Testing: Run the provided test scripts to verify the compiler:
./run-tests.sh