Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOT: Add Graphviz renderer backend #540

Merged
merged 2 commits into from
Apr 6, 2024
Merged

Conversation

Catya3
Copy link
Collaborator

@Catya3 Catya3 commented Apr 6, 2024

Allows easy visualization of IR

Example:

$ go run ../cmd/neva/ build --target dot 2_hello_world/5_with_implicit_any
$ cat program.dot
digraph G {
   subgraph cluster_0 {
     label = "";
     "in:start" [label = "start";];
     "out:stop" [label = "stop";];
     subgraph cluster_1 {
       label = "virtual_emitter_23";
       "virtual_emitter_23:msg" [label = "msg";];
     }
     subgraph cluster_2 {
       label = "virtual_blocker_14";
       "virtual_blocker_14:data" [label = "data";];
       "virtual_blocker_14:data" [label = "data";];
       "virtual_blocker_14:sig" [label = "sig";];
     }
     subgraph cluster_3 {
       label = "printer";
       "printer:data" [label = "data";];
       "printer:sig" [label = "sig";];
     }
   }
  "virtual_emitter_23:msg" -> "virtual_blocker_14:data";
  "virtual_blocker_14:data" -> "printer:data";
  "in:start" -> "virtual_blocker_14:sig";
  "printer:sig" -> "out:stop";
}

Visualizing the graph:

Consider using a VSCode plugin to preview the DOT graph or using an online tool such as https://dreampuf.github.io/GraphvizOnline/ (example)

@Catya3 Catya3 force-pushed the feature-build-dot branch from a239a77 to 8272bc8 Compare April 6, 2024 18:53
@Catya3 Catya3 force-pushed the feature-build-dot branch from 8272bc8 to 6212221 Compare April 6, 2024 18:57
@emil14 emil14 merged commit 19d63a3 into nevalang:main Apr 6, 2024
2 checks passed
@Catya3 Catya3 deleted the feature-build-dot branch April 7, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants