interp con ambientes


Descarga aquí

;; interp : FAE DefrdSub → FAE-Value
(define (interp expr ds)
  (type-case FAE expr
    [num (n) (numV n)]
    [add (l r) (num+ (interp l ds) (interp r ds))]
    [id (v) (lookup v ds)]
    [fun (bound-id bound-body)
      (closureV bound-id bound-body ds)]
    [app (fun-expr arg-expr)
      (local ([define fun-val (interp fun-expr ds)])
        (interp (closureV-body fun-val)
                (aSub (closureV-param fun-val)
                (interp arg-expr ds)
                (closureV-ds fun-val))))]))