WMich Home

 

CS Home

 

Ajay Gupta's Home

 

CS4850 Home
Class Policies  & Syllabus
Topics Covered
Home Work I
Home Work II
Home Work III
Home Work IV
Home Work V
Home Work VI
 
 
 
 
 
Message  Board
Class List
Reading List

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Email webmaster

 

 

 

CS 4850 - Programming Languages

HW4

SummerII 2007

 

Given: August 3, 2007

Due Aug 15, 2007 (11:59pm) (no late submissions)

 

This assignment involves further development of your C/C++/Java program from HW#3 as you implement the EVAL function of LISP. You are to:

  1. Allow for some additional types of symbol table elements, including:

    Type
    Refers to
    S_expr  Pointer to an S_expression. Generate a unique name for each new S_expr. (This will require a pointer field for symbol table entries.)
    Function Any of the implemented LISP function names.

     

  2. Implement the LISP ‘EVAL’ function on the final S_expressions.
    This will involve continuous dynamic use of the symbol table.

  3. The complete output for a LISP statement should consist of the lisp statement in printed form, on the next line show EVAL:   , and make the next line blank (for a separator). No longer print the dotted-notation form of the statement. At the end you should still print the non-empty symbol table entries, as before.


The above will have the effect of implementing an interpretor on a subset of LISP, i.e, as soon as you encounter a fully defined S_expr, evaluate it and thus compute its result.
There are 3 levels of achievement (and points earned) for this assignment. Succesful completion of Level 1 is required to obtain full credit on this assignment.


LEVEL 1 (Scout): 100 points

FCTN

#Parameters

Parameter Type

LENGTH
1
List
+
2
Integer
-
2
Integer
*
2
Integer
/
2
Integer
POW
2
Integer
INCR
1
Integer
DECR
1
Integer
' (quote)
1
List (The identity)
LIST
varies
(any type is allowed)
CAR
1
List
CDR
1
List
NUMBERP
1
(any type is allowed)
LISTP
1
(any type is allowed)
END
0
---



LEVEL 2 (Eagle scout): 130 points

Implement the following 16 functions in addition to Level 1. Note that the abbreviated form for a sequence of car and cdr (row 2 below) can be arbitrary.



CONS, EQ
CAD. . .DR, CD...A...D...AR
ODDP, EVENP
ZEROP, NOT
ATOM, SYMBOLP
<, >, LE, GE
SET, SETQ


LEVEL 3 (Scout scholar): 160 points

Implement DEFUN along with all the above functions of Levels 1 and 2.


Use exception handling for incompatibilities such as: trying to use an unimplemented function; or a non-integer as an integer; or an incompatible operand; or a statement not in a proper form. (25 point penalty otherwise.)

You should use good error recovery as you design your interpretor.


Use yellow pen highlights on your program and output, with handwritten comments, to assist in grading and reading key parts of your program and its output. It is to your advantage to make these things as easy to read and understand as possible.


You will be penalized 10 points for every required LISP function that is not implemented, so be sure to highlight output showing how each works.

The data file will be similar to hw4.dat. Create your own data file to show exhaustively that all of your implemented functions work. Include this and the sample run with your script/zipped-submission-file.

Late Submission

As this is the last week of the semester, no late submissions allowed.

 

Any student may be asked to show and discuss his solution in class, so be ready with your presentation.

For programming assignments, submit a zipped file of your source codes, scripts (to run your program) and report along with a hardcopy of your source codes, scripts, a couple of sample executions of your solution and report.

Use <hw#cs4850_yourlastname_mmddyy.{zip,ppt,doc,tex}> as the naming convention for your zipped, ppt, MS-Word, or LaTex files when emailing your submission to ajay.gupta@wmich.edu. . Replace '#' with the appropriate homework number.

REMINDER: You are responsible for making yourself aware of and understanding the policies and procedures in the undergraduate (pp. 274-276) [Graduate (pp. 25-27)]Catalog that pertain to Academic Integrity. Additionally, easy availability of information, material, source codes, lecture notes etc on the Internet may make it possible to find solutions to your assignments on the Internet or elsewhere. It is okay to refer to those, understand them and use them to enhance your solutions, generate your own ideas etc. However, you must give proper and full credit to original authors of the work, if you include their ideas. Failing to do so is part of academic and professional dishonesty. It will not be tolerated in this class. Do not give in to temptations....

 

 

 

 


Home