aboutsummaryrefslogtreecommitdiff
path: root/discocaml/draw_tree.ml
diff options
context:
space:
mode:
Diffstat (limited to 'discocaml/draw_tree.ml')
-rw-r--r--discocaml/draw_tree.ml8
1 files changed, 7 insertions, 1 deletions
diff --git a/discocaml/draw_tree.ml b/discocaml/draw_tree.ml
index 3429a71..08a8288 100644
--- a/discocaml/draw_tree.ml
+++ b/discocaml/draw_tree.ml
@@ -7,10 +7,12 @@ let add_node (fmt : Format.formatter) (i : expr index) (expr : expr) : unit =
Format.fprintf fmt
" expr%d [fontname=\"CMU Typewriter Text Bold\", label=\"apply\"];\n"
i.index
+ | Bool b -> Format.fprintf fmt " expr%d [label=\"%b\"];\n" i.index b
| Cons _ ->
Format.fprintf fmt
" expr%d [fontname=\"CMU Typewriter Text Bold\", label=\"::\"];\n"
i.index
+ | If (_, _, _) -> Format.fprintf fmt " expr%d [label=\"if\"];\n" i.index
| Int n -> Format.fprintf fmt " expr%d [label=\"%d\"];\n" i.index n
| Lam _ -> Format.fprintf fmt " expr%d [label=\"λ\"];\n" i.index
| Let (recursive, _, _, _) ->
@@ -40,6 +42,10 @@ let add_expr_edges (ast : 'a ast) (fmt : Format.formatter)
| Cons (hd, tl) ->
edge_to hd;
edge_to tl
+ | If (cond, then_, else_) ->
+ edge_to cond;
+ edge_to then_;
+ edge_to else_
| Lam (x, b) ->
Format.fprintf fmt " expr%d -> expr%d_var;\n" i.index i.index;
Format.fprintf fmt " expr%d_var [label=%S];\n" i.index x;
@@ -59,7 +65,7 @@ let add_expr_edges (ast : 'a ast) (fmt : Format.formatter)
edge_to l;
edge_to r
| Var _ -> ()
- | Int _ | Nil -> ()
+ | Bool _ | Int _ | Nil -> ()
in
loop