This project implements a basic front end compiler for a imperative langauge with basic constructs including looping, conditional and functional constructs.
For language implementational details, check test cases and resources.
- The input program code is first tokenized using lexer (lexical analysis) written in python.
- This was developed by generating a Deterministic Finite Automata (DFA) for the langauge. The DFA is converted into a working program using if-else conructs. Refer to code for futher details.
- The tokenized programme(in the form of a list) is given to the parser which carries out syntax analysis.
- The parser we have used is an LL(1) topdown parser, it uses our CFG and parse-table (check credits for the website) do syntax analysis and build the parse tree.
- The parser is also capable of detecting errors and take appropriate action to move forward with the parsing process rather than halting at that point of the program.
- Clone the repository onto your local machine.
- To run the compiler on your own file
Windows:python parser.py [location of the file to run the compiler on]
Ubuntu:python3 parser.py [location of the file to run the compiler on]
This project has been developed under Dr. Aruna Malapati for the course "Compiler Construction" at BITS Pilani Hyderabad Campus.
The parse table for the language is generted using this website.