6 Lab My First Language
— practice with an s-exp language
Exercise 12. Change "arith.rkt" to allow
literal booleans—#false, #true, #f, and
#t—in the same way that literal numbers and strings are allowed.
13. Change the grammar of if
to have then
| Expression|| ||=|| ||...|
| || ||||| ||(if Expression then Expression else Expression)|
Of course, you will need to create your own if
macro to replace the one from racket
You can use a #:datum-literals clause in
syntax-parse to support then and else. But
after you get that working, make #:literals work, which will
involve defining then and else as macros that always
complain if they are used outisde of teir designated positions in
if, like else in racket.
Exercise 14. Make the define-function
language a proper language as implemented by a
"algebra.rkt" module. Allow just the forms in the
grammar—nothing more, nothing less.
Exercise 15. Add 17 additional primitive arithmetic
operators to "algebra.rkt". Don’t wear out your
copy-and-paste keys by making 17 copies of the definition of