Compiler Project


    This is the final project for my compiler class. Using lex and yacc, I was able to create a C-ALGOL-like compiler and produces the NASM assembly code. It first parses input using lex and sends input as tokens to yacc. Yacc takes these tokens and matches it to the defined grammar then does the appropriate syntax directed action. These actions build the Symbol table and the Abstract Syntax Tree (AST). The Symbol table holds all variable, function names along with temporary variables and provides a location in memory. The AST holds the syntax structure of the input and uses this to emit into assembly code. After emitting, you have a NASM source file that can be run and do what the input was written to do.