Lab 5
Develop a (more robust version of the) parser that we sketched on Wednesday in class. It should accept only well-formed s-expressions, and output AE’s. It should check the length of the list. It should include the `with’ form. It should signal an error, by calling error, when the input is not well-formed. Here’s a grammar for the language:
WAE = num | {+ WAE WAE} | {- WAE WAE} | {with {id = WAE} WAE} | id ... where id is an arbitrary symbol.
Write lots of test cases. Use the test/exn form to test your error code.
This will be the basis for the parser that is a part of your remaining assignments, so it would behoove you to do a good job.
From HtDP: Exercises 12.4.1 and 12.4.2. Two hints: write test cases first, and follow the template for functions on lists.
If time: exercises 32.2.1,2,3. (modeling missionaries and cannibals)