Assignment 5

Due November 24, 1999 before noon
  1. Extend our interpreter from the previous assignment and implement assignment, with the following syntax.
    EXP ::== (:= VAR EXP)
    Our parser parses assignment expressions that follow the above syntax and creates records of the type: (define-record varassign (var exp))

  2. Do exercise 5.5.4, using scheme's begin syntax.
    EXP ::== (begin EXP COMPOUND)
    COMPOUND ::== EXP* 
    You will have to extend our parser non-trivially. For compatibility, your parser must create records of the type (define-record begin (exp1 exp2)).

  3. Do exercise 5.5.5 (handle define's). You will need to extend our parser. For compatibility, your parser must create records of the type (define-record define (var exp)).

  4. Extend the interpreter from part one of this assignment to deal with recursion. Do this by introducing letrec expressions to handle recursion with the following syntax (as in scheme)
    EXP ::== (letrec DECLS EXP)
    DECLS ::== (DECL+)
    DECL  ::== (VAR EXP)
    This is almost exactly the same syntax as let expressions, the difference being that the EXP field of a DECL must be a proc expression. However, evaluating letrec expressions is quite a bit different from evaluating let expressions! This part corresponds to exercise 5.6.2. You will have to extend the parser to handle letrec expressions. For compatibility, your parser must create records of the type (define-record letrec (decls body)). decls are made up of decl records that are exactly the same as those defined in our parser for let expressions.

Turning it in

use
% ~cs326/bin/sub5
sub5 will be available Nov 17th, 1999.
Sushil Louis
Last modified: Wed Nov 17 14:55:16 PST 1999