CIS505 Assignment 1

10 points; due Tuesday, September 7
  1. Copy the scanner and parser for the mini-programming language in Chapter 1 into one file and the command interpreter into another. In a third file, write a driver program that reads a source program and then imports and calls the scanner-parser and interpreter modules.
  2. Change the grammar to allow print statement to take a general expression instead of only a variable. Modify the parser/interpreter accordingly.
  3. Add an if-else command to the language, and modify the parser and interpreter. Please submit two test cases for this part.
  4. Add parameterless procedures to the language:
      COMMAND ::= . . . | proc VAR : CLIST end | call VAR  
    In the interpreter, save the body of a newly defined procedure in the namespace. (That is, the semantics of proc I: C end is similar to I = C.) What is the semantics of call I? Implement this.
For part 1 you need to turn in your driver program and a README file on how to run it. You must specify exactly what needs to be typed in a command-line window to run your program. For part 2-4 you need to turn in the new grammar in a textual file, the modified parser/interpreter, and the test cases for item 3.

Submission procedure

Place all your files in a folder, named Ex1, and zip the folder. Submit the zipped folder to the CIS505 site on K-State Online, into the AssignmentDropbox.