4 — Racket Languages 1
Due Tuesday, 06 Feb; 9:00am
; Problem Set 4 ; Lastname1, Firstname1 ; Lastname2, Firstname2
Develop the following Racket languages:
Encode, which presents words via integers. Every top-level form in an Encode module is expected to be an integer that corresponds to a letter. Hint See integer->char. Evaluating an Encode program in DrRacket yields the corresponding string as a result or an error message if any of the integers does not map to a valid keyboard letter.
Echo, which is like Racket but also echos the literal S-expression representation of every top-level form before it evaluates it.
- Spec, which is a simplistic configuration language. It expects that all top-level forms are definitions of identifiers:
(define id1 id2)
It synthesizes a Racket module that quotes all identifiers on the right-hand side of definitions and provides the following three identifiers: x, y, and z. If the Spec programmer fails to define these identifiers, the synthesized module will automatically signal a syntax error. Defined, which pushes all definitions to the top of a module (in order) and leaves all expressions in place (in order). That is, it synthesizes a Racket module that consists of a sequence of definitions followed by a sequence of expressions.
Demonstrate with a simple example that Defined programs behave differently than Racket programs. It should suffice to modify the language status line at the top to demonstrate the differences. Do not rely on error behavior.