For this assignment, you will write code to process simple programs in our little language. It should help you to understand the idea of syntactic abstraction better and to see how much control we can exert over the languages we use at the level of the processor. For this assignment:
This assignment works with a version of the little language we saw for the first time in Session 12, processed in Session 13, and extended in Session 15. I have extended it once more, with a simple Racket-like if expression.
Download the zipped directory
As before, write tests for all the code you write. Put them in a new file homework07-tests.rkt that requires the files of syntax procedures and processors, similar to the test files for previous assignments. The tests are part of the assignment.
- update the header block with your personal information,
- indicate the sections of the code you write or change with comments, and
- add the names of new syntax procedures you write to the provide clause at the top of that file.
I am tired of saying and typing the little language all the time. We could call it LL, but that is boring. Earn an extra-credit point or two by proposing a better name!
> (make-varref 'x) 'x > (make-lambda 'arg 'body) '(lambda (arg) body) > (make-app 'function 'arg) '(function arg) > (make-let 'var 'val 'body) '(let (var val) body) > (make-if 'a 'b 'c) '(if a b c) > (make-lambda 'f (make-app 'f 'x)) '(lambda (f) (f x)) > (make-let 'y (make-app 'f 'x) (make-app 'f 'y)) '(let (y (f x)) (f y))
For Problems 3 and 4, you will extend the little the language to include two new syntactic abstractions, and and or:
<exp> ::= <varref> | <boolean> | (lambda (<var>) <exp>) | (<exp> <exp>) | (if <exp> <exp> <exp>) | (let (<var> <exp>) <exp>) | (and <exp> <exp>) | (or <exp> <exp>)
By the due time and date, submit the following files:
Be sure that your submission follows the submission requirements.