7 #load
"environment.cmo";;
8 #load
"evaluator.cmo";;
12 let (|>) (p
: 'a
) (f
: 'a
-> 'b
) = f p
;;
14 #untrace
Evaluator.eval
;;
15 #load
"evaluator.cmo";;
17 let state = ref { Evaluator.env
= Environment.initial_env
;
19 Evaluator.pending_results
=[[]] };;
21 state := Evaluator.eval
{
22 !state with Evaluator.cont
= [exp
];
23 Evaluator.pending_results
= [[]] };
25 #trace
Evaluator.eval
;;
27 let read s
= Parser.main
Lexer.token
(Lexing.from_string s
);;
28 let rev x
= go (read x
);;
30 (* "(+ 1 (+ 1 (call/cc (lambda (k) (k 3))) 5) 3)" |> rev;; *)
32 (* "(+ 1 1)" |> rev;; *)
33 (* "(define x 1)" |> rev;; *)
34 (* "(define add-x (lambda (y) (+ x y)))" |> rev;; *)
35 (* "(add-x 1)" |> rev;; *)