commit 044e3fb127cb5375ffd8199eca5252723e0f443e Author: Akemi Izuko Date: Tue Nov 14 13:23:54 2023 -0700 Init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72dfbc8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +graphviz/*.svg diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..292fad3 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "walpurgis" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/graphviz/functions.dot b/graphviz/functions.dot new file mode 100644 index 0000000..eba1157 --- /dev/null +++ b/graphviz/functions.dot @@ -0,0 +1,58 @@ +digraph functions { + rankdir=TB; + graph [fontname = "cc wild words"]; + node [fontname = "cc wild words"]; + edge [fontname = "cc wild words"]; + rank=TB; + + subgraph cluster_fn_args_1 { + label="fn_args(GazType)"; + fontname=lovebeat; + rankdir=TB; + newrank=true; + + A1 [label="gen_type(GazType)" shape=diamond style=filled fillcolor=lightcoral]; + B1 [label="pack into var"]; + C1 [label="return" style=filled fillcolor=lightskyblue1]; + A1 -> B1 -> A1; + B1 -> C1; + } + + subgraph cluster_fn_gen_type_2 { + label="fn_gen_type(GazType)"; + fontname=lovebeat; + rankdir=TB; + newrank=true; + + A2 [label="expr for type"]; + B2 [label="literal"]; + C2 [label="variable"]; + D2 [label="subroutine"]; + F2 [label="return" style=filled fillcolor=lightskyblue1]; + + A2 -> A2 [dir=back]; + A2 -> B2 -> A2; + A2 -> C2 -> A2; + A2 -> D2 -> A2; + A2 -> F2; + } + + subgraph cluster_fn_gen_global_type_3 { + label="fn_gen_global_type(GazType)"; + fontname=lovebeat; + rankdir=TB; + newrank=true; + + A3 [label="expr for type"]; + B3 [label="literal"]; + C3 [label="global"]; + D3 [label="function"]; + F3 [label="return" style=filled fillcolor=lightskyblue1]; + + A3 -> A3 [dir=back]; + A3 -> B3 -> A3; + A3 -> C3 -> A3; + A3 -> D3 -> A3; + A3 -> F3; + } +} diff --git a/graphviz/global_flow.dot b/graphviz/global_flow.dot new file mode 100644 index 0000000..86fa9e6 --- /dev/null +++ b/graphviz/global_flow.dot @@ -0,0 +1,27 @@ +digraph flow { + // Global settings + graph [fontname = "cc wild words"]; + node [fontname = "cc wild words"]; + edge [fontname = "cc wild words"]; + rank=TB; + + A0 [label="Global" style=filled fillcolor=gold]; + B0 [label="declare global"]; + C0 [label="end generation"]; + D0 [label="for each undefined subroutine"]; + F0 [label="return" style=filled fillcolor=lightskyblue1]; + + node [shape=diamond style=filled fillcolor=lightsalmon]; + FA0 [label="fn_gen_global_type(GazType)"]; + FB0 [label="fn_gen_main()"]; + FC0 [label="fn_define_subroutine(SubRoutine)"]; + FD0 [label="fn_declare_subroutine()"]; + FE0 [label="fn_gen_typedef()"]; + + A0 -> B0 -> FA0 -> A0; + A0 -> C0 -> FB0 -> D0; + A0 -> FD0 -> A0; + A0 -> FE0 -> A0; + D0 -> FC0 -> D0; + D0 -> F0; +} diff --git a/scripts/build_graphs.sh b/scripts/build_graphs.sh new file mode 100755 index 0000000..1fb0fac --- /dev/null +++ b/scripts/build_graphs.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +declare path="" +declare -ra fnames=( 'functions' 'global_flow' ) + +if [[ "$1" == -h || "$1" == --help ]]; then + cat <