Assignment 6

CS 550 Programming Languages
Instructor: Jeremy Johnson 
Due: Thursday May 30 by 9am

Functional Mini Language (100 points)

This assignment modifies the mini language and mini language interpreter from the lecture on the Mini Language Interpreter to support functional programming. You will treat Proc statements as expressions that can be assigned to variables, passed as arguments to function calls, and returned as values from functions. This also allows unamed functions (like lambda expressions). To do this requires a syntactic change and a semantic change. Now values in an environment can be ints, lists, or procs. Furthermore, you need to allow nested procedures and hence must support a chain of environments. Finally, you will explore both static and dynamic scope rules. You may model your solution after the scheme interpreter and its variants discussed in Metacircular Interpreter Lecture. You should extend the interpreter you wrote from Assignment 2. This assignment may be written in any of the following languages: C, C++, java, python, and their corresponding parser generators, though the current mini language interpreter provided from me is written in C++ and bison(there is some java code but that code does not suppport the extension of the mini language to allow procedures).

Background Information

Background information is available in the lectures on Mini Language Interpreter and scheme interpreter.

What to do

Modify the mini language grammar, parser and interpreter to treat Proc as an expression so that it can be assigned to variables, passed as an argument, and returned as a function value. You must support nested procedures and should use a list of environments to resolve variable references. You wil need to implement two versions of your interpreter: 1) using static scope, and 2) using dynamic scope. You must test your interpreters with mini language programs that have a nested procedure, a procedure that passes a procedure as an argument, a procedure that returns a procedure, and atleast one example where you get different results using static and dynamic scoping.

How to submit

Students should submit their solution electronically via Blackboard Vista. This assignment must be done individually. Only parts that are working will be graded.

The README file should describe all files that are included, contain instructions how to build [you should use make or Ant to build you program and make sure it successfully builds and runs on the CS compute server tux] and use the code, and outline how the code works. The README file should also contain a list of all group members and the group leader for the submitted assignment. You should also indicate how you tested your code. If your program is not working, you should clearly state this in the README file. Code should be documented (clear specifications and comments for any tricky parts of the code).

Since you can do this in a number of languages, submit a makefile . Here is a sample makefile. Please ask for help w/makefiles.

Submit the following files to Bb Vista:

Submit a gzipped tar file, called Afm.tar.gz (the tar file should contain a directory called Af which contains the files). The tar file should contain source code, instructions how to run your programs, sample input and output files, and a README file.

Note: Please pay attention to file names. E.g., makefile is not Makefile, and README is not README.txt.