...
- a boolean constant
true
orfalse
; - a symbol
S
; (list 'not X)
whereX
is abool-SchemeExp
;(list op X Y)
whereop
is'and
,'or
, or'implies
whereX
andY
are {{bool-
SchemeExp}}sSchemeExps
;(list 'if X Y Z)
whereX
,Y
, andZ
are {{bool-
SchemeExp}}sSchemeExps
.
The provided functions parse
and unparse
have the following signatures.
...
We suggest simply traversing the tree using the structural recursion template for type boolExp
and converting all structures (other than if}}s
) to the corresponding {{if
structures.
Write an inductive data definition and template for boolean formulas in if
form, naming this type ifExp
. (Note: make-If
is the only constructor, other than variables and constants, for ifExp
.
...