Expand description

This library defines a DSL for constructing arbitrary graph structures from source code that has been parsed using tree-sitter.


You can use tree-sitter to parse the content of source code into a concrete syntax tree. There are many interesting use cases where you want to use this parsed syntax tree to create some other graph structure. This library lets you do that, using a declarative DSL to identify patterns in the parsed syntax tree, along with rules for which nodes and edges to create for the syntax nodes that match those patterns. You can also annotate each node and edge with an arbitrary set of attributes.

There are no limitations on what graph structure you create: you are not limited to creating a tree, and in particular, you are not limited to creating a tree that “lines” up with the parsed syntax tree.


Defines the AST structure of a graph DSL file

Functions that can be called by graph DSL files

Defines data types for the graphs produced by the graph DSL

Data types and functions for finding and displaying tree-sitter parse errors.

This section defines the graph DSL implemented by this library.


Configuration for the execution of a File

An identifier that appears in a graph DSL file or in the graph that is produced as an output.

The location of a graph DSL entity within its file

Environment of immutable variables


An error that can occur while executing a graph DSL file

An error that can occur while parsing a graph DSL file