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.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/discocaml/draw_tree.ml b/discocaml/draw_tree.ml
index 08a8288..685ef52 100644
--- a/discocaml/draw_tree.ml
+++ b/discocaml/draw_tree.ml
@@ -25,6 +25,9 @@ let add_node (fmt : Format.formatter) (i : expr index) (expr : expr) : unit =
| Prim (Add, _) -> Format.fprintf fmt " expr%d [label=\"+\"];\n" i.index
| Prim (Sub, _) -> Format.fprintf fmt " expr%d [label=\"-\"];\n" i.index
| Prim (Mul, _) -> Format.fprintf fmt " expr%d [label=\"*\"];\n" i.index
+ | Prim (RelOp, (op, _, _)) ->
+ Format.fprintf fmt " expr%d [label=\"%s\"];\n" i.index
+ (string_of_relop op)
| Var x -> Format.fprintf fmt " expr%d [label=%S];\n" i.index x
let add_expr_edges (ast : 'a ast) (fmt : Format.formatter)
@@ -64,6 +67,9 @@ let add_expr_edges (ast : 'a ast) (fmt : Format.formatter)
| Prim (Mul, (l, r)) ->
edge_to l;
edge_to r
+ | Prim (RelOp, (_, l, r)) ->
+ edge_to l;
+ edge_to r
| Var _ -> ()
| Bool _ | Int _ | Nil -> ()
in