Home
  Contact
  Short Vita
  Research
  Teaching
  LSDIS Lab
  Links

Micro Pascal Compiler Project

  1. All students will be implementing a small subset of the programming language Pascal, called Micro-Pascal.
  2. Graduate students will have to implement additional constructs.
  3. You may learn more about Pascal from this Pascal tutorial.
  4. The programming project will be subdivided into four parts. Current assignments are listed below:
    1. Part 1.
      As an example, I am including a Lex specification file for a simple desk calculator. You will have to manually create the file y.tab.h containing token definitions, using #define directives. Please, read some hints about using yytext as an external variable.
      The wordcount (wc) specification presented in class is also available.
    2. Part 2.a) As an example, I am including a YACC specification file for a simple desk calculator, together with the associated LEX specification, and a simple main program.
      A good discussion of shift/reducue and reduce/reduce conflicts is included in the Bison manual.
      A few hints on providing error recovery in YACC-generated parsers are also included, as well as some information on tracing Yacc-generated parsers.
    3. Part 2.b) As an example of using semantic rules in YACC, I am including a YACC specification file for a simple desk calculator (including evaluation of expressions), together with the associated LEX specification, and a simple main program. You will find additional examples on odin in my directory: ~kochut/csx570/semant.
      I also created a page with additional hints on implementing symbol tables and processing procedure/function calls.
    4. Part 3. The last programming assignment is to generate intermediate code for the virtual computer, called UGAVAC.
      UGAVAC intermediate code generation should be handled according to the Micro-Pascal code patterns.
      Some hints on how to facilitate code generation for type conversions in passing parameters in procedure calls are also provided, including the necessary changes to the grammar.
      I have created a page with a few examples of intermediate code generation for Micro-Pascal.