[plt-scheme] cond expression AST

From: m n (monitor10 at gmail.com)
Date: Fri Mar 18 16:17:25 EST 2005

Hi:

    I have a grammar which is:
<expression> ::= cond {<expression> => <expression>}* end

Can I define the AST in the following way? Thanks.

(define-datatype expression expression?
                 (lit-exp
                  (datum number?))
                 (var-exp
                  (id symbol?))
                 (cond-exp
                  (branch (list-of expression? "=>" expression?)))
                 (primapp-exp 
                  (prim primitive?)
                  (rands (list-of expression?))))



Posted on the users mailing list.