let
reduce_in
((
c
:
context
),
e
) = (
c
,
top_reduction
e
);;
let
eval_step
ce
=
reduce_in
(
decompose
ce
);;
The evaluation if the iteration of the one-step reduction until the expression is a value.
let
rec
eval_all
ce
=
try
eval_all
(
eval_step
ce
)
with
Not_found
->
ce
;;
let
eval
e
=
fill_context
(
eval_all
(
Top
,
e
));;
eval
e
;;
- : expr = Const {name=Int 9; constr=true; arity=0}