Imperative Languages

We will not study everything in this area, but selected topics that actually apply to most other languages as well:

  1. types and type compatibility
  2. scope and lifetime
  3. procedures and parameters
  4. run-time structures

An interpreter for a very simple imperative language without these features will act as a base to investigate them. The interpreter is written in Java and is based on the parser generator JavaCC and its preprocessor jjtree.

The basic grammar file written for JavaCC is here. The jjtree file, which is the same grammar annotated for jjtree is here. The interpreter itself is a number of classes generated by jjtree, modifed to achieve the desired reuslt. These will be shown in class. The driver for the interpreter is here.

The basics of using JavaCC to write interpreters is here.