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

Term graph #12

Merged
merged 5 commits into from
Apr 11, 2018
Merged

Term graph #12

merged 5 commits into from
Apr 11, 2018

Conversation

kderme
Copy link
Contributor

@kderme kderme commented Apr 9, 2018

Related Issue #2
This PR adds the option of visualizing the heap as a graph.

  • Module Closure is pure and can be used by any visual backend to visualize the graph.
  • Dot is used for representing the graphs (same as Graph Visualization #11).
  • For each step a new dot file is created. Dot files must be rendered to png to be used by javascript.
  • Nodes of the graph include not only named heap pointers, but also every term that would be represented as a separate heap object.
  • Edges of a Closure point towards its free variables and other heap objects.

A step of examples/skim.hs:

skim

This PR also adds a new example examples/graphs.hs

graph

This is just a first attempt. There are a lot more thing that can be improved, like

  • better visualizations
  • rendering dot files in js
  • Adding Closures for function applications (more here) so that graphs of function application are not generic thunks
  • Eliminating Indirections

@edsko
Copy link
Collaborator

edsko commented Apr 10, 2018

Oooooh! 😍 I'll try to take a look at this tonight. Awesome work!

@edsko
Copy link
Collaborator

edsko commented Apr 10, 2018

@kderme How is the consistency of the graphs from step to step? If you're tracing the execution of a program, how much do the nodes jump around?

@kderme
Copy link
Contributor Author

kderme commented Apr 10, 2018

They actually jump around much less than I expected. I have all results from examples here and a script to run all.

A function can jump from bottom to top after it`s been applied (for example before and after)
Sometimes this can also affect the order of other nodes as dot does some sort of balancing (for example this vs this)

But in general there is a lot of stability.

@edsko
Copy link
Collaborator

edsko commented Apr 10, 2018

Just took a closer look, really cool stuff. Have been wanting to add this but never got around to it. I'm happy to merge this as-is, or do you want to address some of the points you mention above? If not, do you want to open some tickets about those so that we don't forget?

One very minor niggle: typo: Funtion. Also, feel free to add yourself to CONTRIBUTORS and add an entry to the ChangeLog (I can do that also if you prefer).

Nice! :)

@kderme
Copy link
Contributor Author

kderme commented Apr 10, 2018

Happy you liked it. For now I can open some of the issues I mention above. In the future I may find some time to address them.

@edsko
Copy link
Collaborator

edsko commented Apr 11, 2018

Happy you liked it. For now I can open some of the issues I mention above. In the future I may find some time to address them.

Ok, great, merging as is :)

@edsko edsko merged commit 696f9db into well-typed:master Apr 11, 2018
@kderme kderme mentioned this pull request Apr 20, 2018
@kderme kderme deleted the TermGraph branch April 20, 2018 20:25
@@ -1,10 +1,11 @@
module Main (main) where
module Main (main) where
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops..

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.

3 participants