Compiler Assignment

Portfolio Categories: University.

In the second year of university I was tasked with writing a simple compiler for a version of “C–” that would run on a unix server. This meant I had to move from my usual development environment of Microsoft Visual Studio and move onto GC++ on a Linux machine for developing and testing on the server using a Putty terminal

The compiler assignment covered all 3 main aspects of the development of a compiler from starting out with the Lexical Analyser which stepped through the code and tagged every piece of correct code with its lexical token

The syntax analyser then stepped through the code using the created lexical tokens and made sure the code made sense. This was the stage where syntax errors in the code would become apparent (if there were any) And expressions and statements were evaluated.

The third stage, the gener, converted all of the code from the syntax analyser into assembly instructions which were then outputted into a file