- BRIBER Kenza
- GUEMIMI Marouane
- Bassoum Mohamed-Emine
- HISLEUR Guillaume
This project, part of the PCL1 module, focuses on designing and implementing a compiler. It consists of two main phases: PCL1 (October to mid-January) and PCL2.
The PCL1 phase is dedicated to developing:
- A lexical analyzer to identify lexical units.
- A syntax analyzer using recursive functions.
- An abstract syntax tree (AST) to represent parsed structures.
Key Constraint: No generator tools are allowed during the development of lexical and syntax analyzers.
-
Lexical Analysis:
- Implement an automaton to recognize lexical units.
- Ensure correct tokenization of the input source code.
-
Syntax Analysis:
- Develop a recursive-descent syntax analyzer.
- Perform validation of grammar rules.
-
Abstract Syntax Tree (AST):
- Construct an AST to visually and structurally represent syntax analysis results.
| File | Description |
|---|---|
main.py |
Entry point for the compiler. |
tester.py |
Testing framework for compiler validation. |
parser.py |
Syntax analysis functions and terminal definitions. |
ll1_table.py |
LL(1) parsing table used for syntactic rules. |
Lexer.py |
Implementation of the lexer. |
Lib_lex.py |
Auxiliary functions for the lexer. |
syntaxic_tree_builder.py |
Functions for building the syntax tree. |
AST.py |
Functions to construct and manipulate the abstract syntax tree. |
execute this command:
pip install -r ./requirements.txtTo execute the mini compiler:
python ./main.py <input_file>Replace <input_file> with the path to the file you want to compile.
exemple:
python ./main.py ./tests/test1.pyTo generate ASTs for all test cases and corresponding log files (./AST and ./log directories):
python tester.py