* background: BNF grammars
(see apendix A)
rules used to generate programs
---------------------------
|
|
|
|
i
--------------------------
also rules used to parse (match, check) programs
start symbol (input) always at top of tree
describe structure of programs
-> read "is (a)"
alternative notation ::=
| read "or (a)"
nonterminals in sans serif font (in BNF and above )
terminals in typewriter font
so input to the interpreter is an expression or a fundef
examples: (get volunteers to diagram the first 2)
---------------------------
(if x y z)
(set x 3)
(define plus2 (x) (+ x 2))
(define add2 (y)
(begin
(set y (plus2 y)) ; note well how to invoke
y))
---------------------------