From e8c8a162a84fbdcf8b2ea8793b7e9f69b01c7eb6 Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Fri, 19 Jan 2024 12:30:14 -0600 Subject: Start of draw_tree. --- discocaml/discocaml.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'discocaml/discocaml.ml') 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) -- cgit v1.2.3