CS403: Programming Languages

Environment Module

Printable Version

Task Description

This is your fourth milestone assignment. You may develop your code using any procedural language, but you must ensure it runs correctly on a stock linux distribution before submission.

Your task is to write a environment system for holding information about which variables are in scope and what there values are. An environment can be thought of as linked list of tables, each table (from front to back) holds the variables and their values for ever increasingly outer scopes. An environment can also be used during parsing to determine if a variable has been defined before use and to detect type errors in statically typed languages.

You should implement the following environment functions:
Start be reading this.


Specifically, you are to write a environment class or module. One should be able to exercise the environment by typing in the command:
The output of the program should be text of the form:
   Creating a new environment
   The environment is: ...
   Adding variable x with value 3
   The environment is: ...
   Extending the environment with y:4 and z:"hello"
   The local environment is: ...
   The environment is:...

Grading the assignment

Grading will proceed exactly as the previous milestone assignment.

You should provide a makefile that responds to the commands:
    make run

Submitting the assignment

To submit your assignment, delete all object or class files from your working directory, leaving only source code, a makefile, a readme file, and any test cases you may have. Then, while in your working directory, type the command
    submit proglan lusth environment
The submit program will bundle up all the files in your current directory and ship them to me. This includes subdirectories as well since all the files in any subdirectories will also be shipped to me.

You may submit as many times as you want before the deadline; new submissions replace old submissions.