More work on barf.
This commit is contained in:
@@ -264,6 +264,14 @@ CFG for the BARF language:
|
||||
[(Lambda par body) (eval-lambda arg par body)]
|
||||
[_ (error 'eval-call "Expected lambda expression to call, instead got: ~s." f)])]))
|
||||
|
||||
(: findfun : Symbol PROGRAM -> FUN)
|
||||
; Finds the Fun.
|
||||
(define (findfun fname prog)
|
||||
(define foundfun (cases prog [(Prog flist)
|
||||
(ormap (lambda (f) (cases f [(Fun name param body)
|
||||
(if (string=? name fname) (f) (#f))])))]))
|
||||
(if (not foundfun) (error 'findfun "Function not found.") foundfun))
|
||||
|
||||
(: eval : BARF -> Primitive)
|
||||
;; evaluates BARF expressions by reducing them to numbers
|
||||
(define (eval expr)
|
||||
|
||||
Reference in New Issue
Block a user