Lecture: Mini Language Compiler

Background Material

Reading

Theme

This lecture shows how to write a compiler that translates Mini Language programs to programs that execute on a simpler model of computation, namely a bounded memory random access machine with a single accumulator. The compiler uses the same infrastructure for parsing that the Mini Language Interpreter used.

Topics

  1. Random Access Machine (RAM) model.
  2. Random Access Machine Assembly Language (RAL)
  3. Compiling Mini Language expressions and statements to RAL
  4. Symbol Table, Memory Model and Linking symbolic RAL programs.
  5. Simple optimizations
  6. Adding support for procedures
    1. Activation records and local variables
    2. Parameter passing
    3. return statement
    4. Call stack

Lecture Notes

Programs

Exercises

Created: May 8, 2008 (revised May 18, 2012) by jjohnson AT cs DOT drexel DOT edu