Skip to content

[Fun] Render nested ASCII diamonds #211

Description

@katrinafyi

There's a data type of nested diamonds in the ASLp frontend. This represents control flow branches, but at the moment it's printed as an Ocaml record which makes the control flow structure hard to see.

For debugging and expect tests, it would be nice to have a visual representation of the CFG, something like this:

     2
    / \
   2   2
    \ /
     1
    / \
   /   2
  /   / \
 1   2   2
  \   \ /
   \   1
    \ /
     0

Because the structure is just diamonds of diamonds, it should be possible (easy?) to write a recursive algorithm to do this. It just needs to calculate the size of outer diamonds based on the size of inner diamonds.

I would be happy to advise and talk about this task if anyone wants a small fun job :)

For comparison, this is the current printed representation of the diamonds:
https://github.com/agle/bincaml/blob/495be8e64264de2aceca634d34f72d35cc474260/test/transforms/test_aslp.ml#L74-L89

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions