This commit is contained in:
Akemi Izuko 2023-11-14 13:23:54 -07:00
commit 044e3fb127
Signed by: akemi
GPG key ID: 8DE0764E1809E9FC
6 changed files with 122 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/target
graphviz/*.svg

8
Cargo.toml Normal file
View file

@ -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]

58
graphviz/functions.dot Normal file
View file

@ -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;
}
}

27
graphviz/global_flow.dot Normal file
View file

@ -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;
}

24
scripts/build_graphs.sh Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
declare path=""
declare -ra fnames=( 'functions' 'global_flow' )
if [[ "$1" == -h || "$1" == --help ]]; then
cat <<HELP
Builds the digraphs for this project. Must be run from top level git directory
HELP
exit 0
elif [[ -d .git ]]; then
path="./graphviz"
elif [[ -d ../.git ]]; then
path="../graphviz"
else
cat <<HELP
Builds the digraphs for this project. Must be run from top level git directory
HELP
exit 1
fi
for name in "${fnames[@]}"; do
dot -Tsvg -o "${path}/${name}.svg" "${path}/${name}.dot"
done

3
src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}