Skip to content
/ PL Public

Implementation of a custom language compiler. It includes lexical, syntactical, static-semantics analyzers and code generation for the abstract p-machine. Done in collaboration with Bittor Alaña.

Notifications You must be signed in to change notification settings

frblazquez/PL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language Processors

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.

Repository structure

  • Session1: Lexical analyzer construction with JLex.
  • Session2: Syntactical analyzer construction with CUP.
  • frabit: Custom full language processor.

frabit language specifications

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:

frabit execution

# 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.