Lecture: Mini Language Compiler
- Lecture on the Mini Language Interpreter.
- Chapter 5 of the text (Target Machine Architecture)
- Chapter 14 of the text (Building a Runnable Program)
- Chapter 16 of the text (Code Improvement)
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
- Random Access Machine (RAM) model.
- Random Access Machine Assembly Language (RAL)
- Compiling Mini Language expressions and statements to RAL
- Symbol Table, Memory Model and Linking symbolic RAL programs.
- Simple optimizations
- Adding support for procedures
- Activation records and local variables
- Parameter passing
- return statement
- Call stack
- ram.h - interface for RAM simulator class
- inst.h - instruction opcodes for RAM
- ram.cpp - implementation of RAM simulator
- main.cpp - main program to run RAM simulator
- prog.txt - sample RAM program
- mem.txt - sample RAM memory configuration
Created: May 8, 2008 (revised May 18, 2012) by jjohnson AT cs DOT drexel DOT edu
- Compile and run the RAM simulator on a sample RAL program.
- Write a RAL program which takes two input integers at addresses 1
and 2 and multiplies them storing the result at address 4. You
may assume that they are non-negative.
- Extend the RAM simulator to support the MUL and JMZ instructions.
- assignment 3.
- assignment 4.