This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: The grammar and semantics of Beginning Student as discussed in class CS 135 Fall 2008 1 The grammar Here are all the grammatical rules for Beginning Student as covered in class 1 through the end of lecture module 04. When doing traces by hand, these are the rules that are expected. h program i = h def-or-expr i ... h def-or-expr i = h def i | h exp i h def i = (define ( h id i h id i ... h id i ) h exp i ) h def i = (define h id i h exp i ) h def i = (define-struct h id i ( h id i ... h id i )) h prim-op i = built-in function names h prim-op i = c-s1 | ... | c-sn | c? (where c is a structure with fields s1 ... sn ) h exp i = h id i h exp i = h val i h exp i = ( h id i h exp i ... h exp i ) h exp i = ( h prim-op i h exp i ... h exp i ) h exp i = (cond [ h exp i h exp i ] ... [ h exp i h exp i ]) h exp i = (cond [ h exp i h exp i ] ... [else h exp i ]) h exp i = (and h exp i ... ) h exp i = (or h exp i ... ) h val i = h number i | h symbol i | h string i | true | false | h posn i | h lstval...
View Full Document
This note was uploaded on 10/21/2010 for the course CS 135 taught by Professor Vasiga during the Fall '07 term at Waterloo.
- Fall '07