...
- the boolean constants
true
andfalse
; - boolean variables (represented by symbols other than
true
,false
,not
,and
,or
,implies
, andif
) that can be bound to eithertrue
orfalse
. - the unary operator
not
. - the binary operators
and
,or
, andimplies
(denoted by the symbolsand
,or
, andimplies
, respectively), and - the ternary operator
if
.
The course staff is providing function parse
and unparse
(in the file 6-parser.ss that convert boolean expressions in Scheme notation to a simple inductively defined type called boolExp
and vice-versa. The
coding of parse
and unparse
is not difficult, but it is tedious (like most parsing) so the course staff is providing this code rather than asking students to write it.
...
- a boolean constant
true
andfalse
; - a symbol
S
representing a boolean variable; (make-Not X)
whereX
is aboolExp
;(make-And X Y) where = X
andY
are {{boolExp}}s;(make-Or X Y) where = X
andY
are {{boolExp}}s;(make-Implies X Y) where =X
andY
are ={{boolExp=}}s; or(make-If X Y Z)
whereX
,Y
, andZ
are ={{boolExp=}}s.
A bool-SchemeExp is either:
...