terror / terror/dotgraph

Attribute resolution and intermediate representation

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

The parsed AST is a syntactic representation of the DOT file. The renderer needs a semantic intermediate representation (IR) that resolves attribute inheritance, deduplicates nodes, and builds an adjacency structure suitable for layout algorithms.

The IR consists of IrGraph (nodes, edges, clusters, graph-level attributes), IrNode (id, label, resolved attributes, position/size slots for layout to fill), IrEdge (from/to indices, label, resolved attributes, routed points for layout to fill), and IrCluster (node indices, sub-clusters, bounding box for layout to fill). Attributes are stored as a string map with typed accessor methods for known attributes like shape, color, and fontsize; unknown attributes are silently ignored.

The AST-to-IR lowering pass walks statements in order, maintaining a scope stack with default attribute maps for graph, node, and edge targets. AttributeStatement updates the current scope's defaults. Nodes are deduplicated by ID, with later attribute declarations merged in. Edge chains like A -> B -> C are expanded into individual edges. Subgraphs whose IDs start with cluster_ produce IrCluster entries. Subgraph edge targets are expanded to edges from/to all nodes in the subgraph.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the parsed AST, renderer entry point, and AST-to-IR lowering pass described in the issue. Review how statements, subgraphs, attributes, and edge chains are represented before designing the IR. Done means the lowering pass resolves inherited attributes, deduplicates nodes, expands edges, and produces the specified graph, node, edge, and cluster structures.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.