An implementation of the "Classroom Object-Oriented Language" compiler for Compilers course in Shoubra Faculty of Engineering.
The files in this directory can get pretty messy, so here is a basic tour:
This directory contains the classes and code for Lexical Analyzer phase.
This directory contains the classes and code for Parese Tree phase.
- Install intelliJ IDEA.
- Install ANTLRv4. Please follow the quickstart guide here, or you can simply install ANTLR from IDEA's plugin manager.
- Import antlr runtime jar.
- To connect intellij with ANTRL see this video.
- Use your terminal to run the program.
- First, create the Token file which contains all the tokens we want to compile and its possible values.
- Press right click and click generate Antlr Recognizer.
- Second, Create controller.java that will test the cool input using tokens and generated files
- Pass the test cases files named (good.cl or bad.cl) as an argument to main.
- If there are no errors, the program will output a sequence of tokens in a file called good.cl-lex, otherwise it will report errors with their line numbers.
- First, create the Token file which contains all the tokens we want to compile and its possible values.
- Create the grammer file and import the token file in it and put all the cool relues
- Press right click and click generate Antlr Recognizer.
- Create the ParseErrorListener class in which you can listen for sentax error
- Create controller.java that will test the cool input using tokens and generated files
- Pass the test cases files named (good.cl or bad.cl) as an argument to main.
- If there are no errors, the program will output a sequence of tokens in a file called good.cl-lex and will write the parse tree in the good-cst file
- Otherwise it will report errors with their line numbers .