Input a C code (with some syntaxes restricted such as includes), the lexical analyzer analyzes the tokens, passes the token stream on to the Intermediate Code Generator which generates a equivalent 8086 Assembly code using a predefined set of grammars.
Peephole Optimizer is used to optimize the 8086 Assembly code runtime.
Execute the following command to prepare the binaries.
$ make
A binary named icg
will be generated. If you have a C-subset code in a file named
input.c, run the following command.
$ ./icg input.c
A equivalent 8086 Assembly code will be generated in code.asm file. Additionally, a text file named error.txt is also created which contains list of errors encountered during compilation i.e. code generation.
- flex
- bison
- CMake