Skip to content

Instantly share code, notes, and snippets.

@Cypher1
Last active November 22, 2022 02:55
Show Gist options
  • Save Cypher1/0ea94a1a263bd83b3c7836b9a35e5c38 to your computer and use it in GitHub Desktop.
Save Cypher1/0ea94a1a263bd83b3c7836b9a35e5c38 to your computer and use it in GitHub Desktop.
Compiler Architecture
# Copyright 2022 Google LLC.
# SPDX-License-Identifier: Apache-2.0
digraph architecture {
subgraph cluster_01 {
node [shape=plaintext]
label = <<b>Legend</b>>;
{rank=same; key, key2 }
key [label=<<table border="0" cellpadding="2" cellspacing="0" cellborder="0">
<tr><td align="right" port="i1">Requests (internal)</td></tr>
<tr><td align="right" port="i2">Response (internal)</td></tr>
<tr><td align="right" port="i3">Commands (external)</td></tr>
<tr><td align="right" port="i4">Stats &amp; Errors</td></tr>
<tr><td align="right" port="i5">Interactions</td></tr>
<tr><td align="right" port="i6">Interactions with dependencies</td></tr>
</table>>]
key2 [label=<<table border="0" cellpadding="2" cellspacing="0" cellborder="0">
<tr><td port="i1">&nbsp;</td></tr>
<tr><td port="i2">&nbsp;</td></tr>
<tr><td port="i3">&nbsp;</td></tr>
<tr><td port="i4">&nbsp;</td></tr>
<tr><td port="i5">&nbsp;</td></tr>
<tr><td port="i6">&nbsp;</td></tr>
</table>>]
key:i1:e -> key2:i1:w [color="#0000ff"];
key:i2:e -> key2:i2:w [color="#0000ff", style=dashed];
key:i3:e -> key2:i3:w [color="#00cc00", style=bold];
key:i4:e -> key2:i4:w [color="#ff7777"];
key:i5:e -> key2:i5:w [style=dashed];
key:i6:e -> key2:i6:w [color="#000000"];
}
user [label="User"];
file_system [label="File System"];
subgraph cluster_compiler {
label=<<b>Compiler</b>>;
file_watcher [label="File Watcher"];
run_tests [label="Run Tests", style=bold];
abstract_interpret_module [label="Abstract Interpret Module"];
optimize_module [label="Optimize Module"];
optimize_binary [label="Optimize Binary"];
check_module [label="Check Module"];
interpret_file [label="Interpret File", style=bold];
lex_file [label="Lex File"];
parse_file [label="Parse File"];
load_file [label="Load File"];
codegen_binary [label="Codegen Binary"];
save_binary [label="Save Binary", style=bold];
}
subgraph cluster_ui {
label=<<b>User Interface</b>>;
repl [label=<REPL &amp; Commands>];
status_reporter [label=<Status Reporter>];
}
user -> repl [color="#000000", style=dashed];
status_reporter -> user [color="#000000", style=dashed];
repl -> save_binary [color="#00cc00", style=bold];
repl -> interpret_file [color="#00cc00", style=bold];
repl -> run_tests [color="#00cc00", style=bold];
file_system -> user [dir=both, style=dashed];
file_watcher -> file_system [color="#000000"];
load_file -> file_watcher [color="#0000ff"];
file_watcher -> load_file [color="#0000ff", style=dashed];
load_file -> file_system [color="#000000"];
save_binary -> file_system [color="#000000"];
run_tests -> save_binary [color="#0000ff"];
save_binary -> run_tests [color="#0000ff", style=dashed];
load_file -> status_reporter [color="#ff7777", arrowsize=0.5];
lex_file -> status_reporter [color="#ff7777", arrowsize=0.5];
parse_file -> status_reporter [color="#ff7777", arrowsize=0.5];
interpret_file -> status_reporter [color="#ff7777", arrowsize=0.5];
abstract_interpret_module -> status_reporter [color="#ff7777", arrowsize=0.5];
check_module -> status_reporter [color="#ff7777", arrowsize=0.5];
optimize_module -> status_reporter [color="#ff7777", arrowsize=0.5];
optimize_binary -> status_reporter [color="#ff7777", arrowsize=0.5];
codegen_binary -> status_reporter [color="#ff7777", arrowsize=0.5];
save_binary -> status_reporter [color="#ff7777", arrowsize=0.5];
lex_file -> load_file [color="#0000ff"];
parse_file -> lex_file [color="#0000ff"];
abstract_interpret_module -> parse_file [color="#0000ff"];
check_module -> abstract_interpret_module [color="#0000ff"];
interpret_file -> abstract_interpret_module [color="#0000ff"];
optimize_module -> check_module [color="#0000ff"];
optimize_binary -> optimize_module [color="#0000ff"];
codegen_binary -> optimize_binary [color="#0000ff"];
save_binary -> codegen_binary [color="#0000ff"];
load_file -> lex_file [color="#0000ff", style=dashed];
lex_file -> parse_file [color="#0000ff", style=dashed];
parse_file -> abstract_interpret_module [color="#0000ff", style=dashed];
abstract_interpret_module -> check_module [color="#0000ff", style=dashed];
abstract_interpret_module -> interpret_file [color="#0000ff", style=dashed];
check_module -> optimize_module [color="#0000ff", style=dashed];
optimize_module -> optimize_binary [color="#0000ff", style=dashed];
optimize_binary -> codegen_binary [color="#0000ff", style=dashed];
codegen_binary -> save_binary [color="#0000ff", style=dashed];
}
@Cypher1
Copy link
Author

Cypher1 commented Nov 17, 2022

Generate image with

dot dot.dot -Tpng -Gsize=9,9\! -Gdpi=100 -O

@Cypher1
Copy link
Author

Cypher1 commented Nov 17, 2022

dot dot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment