This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · lib/proggraph

The program graph as data

graph_of_self() and program_graph("scf/story_water") give a program's graph as a ProgramGraph: its defs, the steps inside them, the loops that hold steps and its record types are the nodes; calls and the values steps hand each other are the edges. The compiler fills the record when it reads the program, so every engine sees the same data.

Node k is entry k of each node list. A list of names (params, reads, writes, globals, calls, edge_vars) is one string per node or edge, the names separated by spaces: split(g.reads[k]) is the list. A parent or owner of -1 is none.

Used with import proggraph.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

This program declares a record type (ProgramGraph), and records run only in compiled C for now, so the Run buttons here are off. Open it in the workbench and use its C tab to compile it.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

[1]lines 20–126