A Compiler for a subset of Pascal

For this assignment, the task was to implement the basic components of a compiler for a subset of Pascal. Detail of the assignment can be found at the APPENDIX section of The dragon book of Compiler. Stuffs I did here was:

  • Design and develop a symbol-table mechanism.
  • Write a lexical analyzer.
  • Write semantic actions and the parser.
  • Code generation (i.e. generate intermediate assembly code for a given progam in Pascal using the parser developed in previous step).

Development platform
This project is developed in C using Lex and Yacc. Generated assembly code was compiled with Netwide Assembler (NASM).

Source code
The source code contains all the four parts of this compiler task. It also includes shell scripts to build lexical analyzer and parser, nasm commands etc (All the stuffs I used while doing this assignment). You can download it here.