diff options
Diffstat (limited to 'discocaml/draw_tree.ml')
-rw-r--r-- | discocaml/draw_tree.ml | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/discocaml/draw_tree.ml b/discocaml/draw_tree.ml index 16719df..f0badd7 100644 --- a/discocaml/draw_tree.ml +++ b/discocaml/draw_tree.ml @@ -88,13 +88,24 @@ let draw_tree (ast : expr ast) : string = let fmt = Format.formatter_of_buffer buf in Format.fprintf fmt "digraph {\n"; Format.fprintf fmt " node [shape=\"box\", style=\"rounded\"];\n"; + add_expr_edges ast fmt nodes ast.root; Format.fprintf fmt "\n"; + IntSet.iter (fun index -> let i = { index } in add_node fmt i (get_subexpr ast i)) !nodes; + + get_binders ast + |> Array.iteri (fun i -> function + | Some j -> + Format.fprintf fmt + " expr%d -> expr%d_var [color=\"#cccccc\", constraint=false];\n" i + j.index + | None -> ()); + Format.fprintf fmt "}\n"; Format.pp_print_flush fmt (); Buffer.contents buf |