aboutsummaryrefslogtreecommitdiff
path: root/discocaml/discocaml.ml
diff options
context:
space:
mode:
Diffstat (limited to 'discocaml/discocaml.ml')
-rw-r--r--discocaml/discocaml.ml21
1 files changed, 12 insertions, 9 deletions
diff --git a/discocaml/discocaml.ml b/discocaml/discocaml.ml
index ba407c1..a3f34f7 100644
--- a/discocaml/discocaml.ml
+++ b/discocaml/discocaml.ml
@@ -44,28 +44,31 @@ let handle_request { expr; command } : response =
let buf = Lexing.from_string expr in
let expr = Parse.expression buf in
let expr = expr_of_parsetree expr in
+ let binders = get_binders expr in
let expr_response ?(note : string option) (expr : expr ast) : response =
`Expr
{
expr = show_expr expr;
- has_redex = Option.is_some (Eval.find_redex_cbn expr);
+ has_redex = Option.is_some (Eval.find_redex_cbn expr binders);
note;
}
in
- let step_with (find_redex : expr ast -> expr index option) (expr : expr ast)
- : expr ast =
- match find_redex expr with
- | Some i -> Eval.reduce expr i
+ let step_with
+ (find_redex : expr ast -> binder_info option array -> expr index option)
+ (expr : expr ast) : expr ast =
+ match find_redex expr binders with
+ | Some i -> Eval.reduce expr binders i
| None -> failwith "no redex"
in
- let run_with (find_redex : expr ast -> expr index option) :
- expr ast -> expr ast Seq.t =
+ let run_with
+ (find_redex : expr ast -> binder_info option array -> expr index option)
+ : expr ast -> expr ast Seq.t =
let rec loop (expr : expr ast) : expr ast Seq.t =
Seq.cons expr (fun () ->
- match find_redex expr with
- | Some i -> loop (Eval.reduce expr i) ()
+ match find_redex expr binders with
+ | Some i -> loop (Eval.reduce expr binders i) ()
| None -> Nil)
in
loop