CS 330 Home Schedule Resources

Assignment 5
Midterm Project (PART 1)

Writing a kernel language interpreter

The objective of this homework is to a) better understand the operational behavior of a program when it is executed, and b) learn how to interpret a "little language".

Estimated time: 5-6 hours
DUE DATE: Monday Feb 13, by midnight

Executing a program typically consists of

  1. tokenizing a string
  2. parsing concrete syntax into abstract syntax
  3. translating the full language abstract syntax into the kernel language abstract syntax
  4. executing the abstract syntax of the kernel language
(Here is a link with more information.)

In this assignment you will write the code for the last bullet using an interface we give you for creating/modifying the semantic stack, the environment and the store. In PART 2, you will do the rest of the bullets and write your own implementation for the stack, environment, and store.

To write the interpreter that executes the kernel language you will need to write three functions: ExecuteProgram, ExecuteStatement, and CreateVal. There is a skeleton of the program for you here. The utilities module you'll link in is here. NOTE: You will implement the semantics of the first eight kernel statements; you do NOT need to implement the 'case'.

  • Feedback.
    Scale
    1. Not at all
    2. Not very
    3. Slightly
    4. Somewhat
    5. Mostly
    6. Very
    7. Extremely