Development of a custom c-style language processor. It includes lexical, syntactical and static-semantics analyzers including error recovery techniques and code generation for the abstract p-machine.
- Session1: Lexical analyzer construction with JLex.
- Session2: Syntactical analyzer construction with CUP.
- frabit: Custom full language processor.
Frabit is our language processor. It reads from a file a program, checks its lexical, syntactical and semantical correction and, if correct, generates the code for the abstract p-machine of the program. If the program given is not correct error recovery techniques are applied in order to continue the analysis and detect as much errors as possible.
The rules applied by the analyzers as well as the format of the generated resulting code is given by:
- Lexical specification: JLex specification, package alex.
- Syntactical specification: CUP specification package asint.
- Errors management: Error management package errors.
- Semantical specification: docs/frabit_specification.pdf, package asem and AST.
- P-Machine code generation: docs/p-machine_instructions.pdf, package code and AST.
# Clone the repo
git clone https://github.com/frblazquez/PL.git
# Place JLex and CUP jars in PL/frabit/ and then run the analyzers generation scripts
cd PL/frabit/
./jlex.sh
./cup.sh
# Compile the java code (requires JLex and CUP in the classpath) and run the tests
./run_testfiles.sh
It's strictly necessary to run the test script for generating the p-machine interpreter. After this, the configuration is complete and it's possible to compile frabit code running the Main, it accepts as arguments the input and desired output files. This output file can be run in the p-machine interpreter.