diff options
Diffstat (limited to 'discocaml')
-rw-r--r-- | discocaml/draw_tree.ml | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/discocaml/draw_tree.ml b/discocaml/draw_tree.ml index 6b6ce91..14c08af 100644 --- a/discocaml/draw_tree.ml +++ b/discocaml/draw_tree.ml @@ -4,7 +4,7 @@ module IntSet = Set.Make (Int) let fmt_with_possible_subscript (fmt : Format.formatter) (s : string) : unit = match Util.break_to_subscript s with | Some (name, sub) -> - Format.fprintf fmt "<%s<FONT POINT-SIZE=\"12\"><SUB>%d</SUB></FONT>>" name + Format.fprintf fmt "<%s<FONT POINT-SIZE=\"16\"><SUB>%d</SUB></FONT>>" name sub | None -> Format.fprintf fmt "%S" s @@ -68,13 +68,13 @@ let add_expr_edges (ast : 'a ast) (fmt : Format.formatter) 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=%a];\n" i.index - fmt_with_possible_subscript x; + Format.fprintf fmt " expr%d_var [label=%a, shape=\"ellipse\"];\n" + i.index fmt_with_possible_subscript x; edge_to b | Let (_, name, bound, body) -> Format.fprintf fmt " expr%d -> expr%d_var;\n" i.index i.index; - Format.fprintf fmt " expr%d_var [label=%a];\n" i.index - fmt_with_possible_subscript name; + Format.fprintf fmt " expr%d_var [label=%a, shape=\"ellipse\"];\n" + i.index fmt_with_possible_subscript name; edge_to bound; edge_to body | Prim (Add, (l, r)) -> @@ -98,7 +98,9 @@ let draw_tree (ast : expr ast) : string = let buf = Buffer.create 16 and nodes = ref IntSet.empty in let fmt = Format.formatter_of_buffer buf in Format.fprintf fmt "digraph {\n"; - Format.fprintf fmt " node [shape=\"box\", style=\"rounded\"];\n"; + Format.fprintf fmt + " node [fontsize=\"20pt\", penwidth=\"2.0\", shape=\"box\", \ + style=\"rounded\"];\n"; add_expr_edges ast fmt nodes ast.root; Format.fprintf fmt "\n"; |