aboutsummaryrefslogtreecommitdiff
path: root/discocaml/draw_tree.ml
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-01-24 10:02:08 -0600
committerNathan Ringo <nathan@remexre.com>2024-01-24 10:02:08 -0600
commit6fb1c813dbe2227dab3faac3fc405260be185eca (patch)
tree69d1db686036805dbab17cf9335f674c8a8c0b5a /discocaml/draw_tree.ml
parent4f3a5d390443573b60e583d1c965eb336d08ff68 (diff)
Bump up the font size, making the overall image "more compact."
Diffstat (limited to 'discocaml/draw_tree.ml')
-rw-r--r--discocaml/draw_tree.ml14
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";