aboutsummaryrefslogtreecommitdiff
path: root/discocaml/discocaml.ml
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-01-19 12:30:14 -0600
committerNathan Ringo <nathan@remexre.com>2024-01-19 12:30:14 -0600
commite8c8a162a84fbdcf8b2ea8793b7e9f69b01c7eb6 (patch)
tree2d80a20d429ddf706f3755458f6f2ade73334201 /discocaml/discocaml.ml
parent786adbe1537782abbf953dd1978075cafcd1d002 (diff)
Start of draw_tree.
Diffstat (limited to 'discocaml/discocaml.ml')
-rw-r--r--discocaml/discocaml.ml6
1 files changed, 4 insertions, 2 deletions
diff --git a/discocaml/discocaml.ml b/discocaml/discocaml.ml
index f11a81b..df5cef3 100644
--- a/discocaml/discocaml.ml
+++ b/discocaml/discocaml.ml
@@ -17,7 +17,8 @@ type request = { expr : string; command : command }
type response_expr = { expr : string; has_redex : bool }
[@@deriving to_yojson { exn = true }]
-type response = [ `Error of string | `Expr of response_expr ]
+type response =
+ [ `Error of string | `Expr of response_expr | `Graphviz of string ]
[@@deriving to_yojson { exn = true }]
let%expect_test _ =
@@ -55,7 +56,8 @@ let handle_request { expr; command } : response =
| `Parse -> expr_response expr
| `StepCBN -> expr_response (step_with Eval.find_redex_cbn expr)
| `StepCBV -> expr_response (step_with Eval.find_redex_cbv expr)
- | `DrawTree | `RunCBN | `RunCBV -> failwith "not implemented"
+ | `DrawTree -> `Graphviz (Draw_tree.draw_tree expr)
+ | `RunCBN | `RunCBV -> failwith "not implemented"
with
| Failure msg -> `Error msg
| exn -> `Error ("uncaught exception: " ^ Printexc.to_string exn)