CSci 555: Functional Programming
Fall Semester 1998

Assignment #6
Due 7 December 1998


Note: After the assignment was collected, I revised the assignment statement to correct ambiguities concerning negative constants and sets of undefined variables.

The purpose of this assignment is to develop an interpreter for the simple language described below. Syntactically, the language is similar to the language Lisp.

Syntax. The following extended BNF grammar describes the commands that a user can enter into the interpreter. Nonterminal symbols are shown in uppercase. Terminal symbols are in lowercase. The symbols |, [ ], ^*, and ::= are part of the extended BNF metalanguage. The ^* is the superscript asterisk character denoting zero or more repetitions of the element (i.e., star-closure). The start symbol is COMMAND.

COMMAND  ::=  EXPR  |  ASSIGN  |  quit 
ASSIGN   ::=  ( set VAR EXPR )
EXPR     ::=  VAL
           |  VAR
           |  ( OPTR EXPR EXPR )
OPTR     ::=  +  |  -  |  *  |  /
VAL      ::=  [ - ] UNSIGNED
UNSIGNED ::=  DIGIT DIGIT^*
VAR      ::=  ALPHA ALPHANUM^*

Semantics. A value is assigned to a syntactic element as follows:

Tasks. Implement the following Haskell functions:

Test your functions appropriately and thoroughly. Please format and document your program source code appropriately.

When this assignment is complete, submit a paper listing of your program source code and the screen outputs from executing the program. Be sure that all items submitted are clearly labeled with your name and the assignment number. Include the Honor Code statement as described in the Assignments section of the Syllabus.

Also submit your program source code using EASE, the Electronic Assignment Submission Environment, at URL http://www.cs.olemiss.edu/submit/. Your username for that system is your sunset account name. (If this system is not working for you, send the files to me in email at cunningham@cs.olemiss.edu)


UP to CSCI 555 assignments document?


Copyright © 1999, H. Conrad Cunningham
Last modified: Wed May 12 11:09:27 CDT