example_parse_calc_wae - (cond [(number? WAE) (num WAE)]...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#lang planet plai/plai (define-type WAE [num (n number?)] [add (lhs WAE?) (rhs WAE?)] [sub (lhs WAE?) (rhs WAE?)] [with (name symbol?) (named-expr WAE?) (body WAE?)] [id (name symbol?)]) ) (define (parse WAE)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (cond [(number? WAE) (num WAE)] [(list? WAE) (case (first WAE) [(+) (add (parse (second WAE)) (parse (third WAE)))] [(-) (sub (parse (second WAE)) (parse (third WAE)))] ) ] ) )...
View Full Document

Ask a homework question - tutors are online