#lang plai
;; You have to install the PLAI language before you can run this.
;; In DrScheme's File menu, select "Install .plt File..." and enter this URL:
;; http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/plai-4.plt

(define-type Binding
  [binding (name symbol?) (named-expr CFCFWAE?)])

(define-type CFCFWAE
  [num (n number?)]
  [binop (op procedure?) (lhs CFCFWAE?) (rhs CFCFWAE?)]
  [with (lob (listof Binding?)) (body CFCFWAE?)]
  [id (name symbol?)]
  [if0 (test-e CFCFWAE?) (then-e CFCFWAE?) (else-e CFCFWAE?)]
  [fun (args (listof symbol?)) (body CFCFWAE?)]
  [app (fun CFCFWAE?) (args (listof CFCFWAE?))])

(define cfcfwae-keywords '(fun with if0))

;; cfcfwae-keyword? : symbol -> boolean
;; true only if the symbol is a syntactic keyword of this language
(define (cfcfwae-keyword? sym)
  (error "not implemented"))

;; cfcfwae-op? : symbol -> boolean
;; true only if the symbol is an operator name
(define (cfcfwae-op? sym)
  (error "not implemented"))

;; cfcfwae-reserved? : symbol -> boolean
;; true only if the symbol is a keyword or operator name
(define (cfcfwae-reserved? sym)
  (error "not implemented"))

;; parse : s-exp -> CFCFWAE
;; consumes an s-expression and produces the corresponding CFCFWAE
;; indicates parsing errors using (error "appropriate message")
(define (parse sexp)
  (error "not implemented"))

;; interp : CFCFWAE -> CFCFWAE
;; evaluates CFCFWAE expressions by reducing them to their corresponding values
;; return values are either num or fun
(define (interp expr)
  (error "not implemented"))
