AST Nodes¶
Abstract syntax tree node definitions for the QVR DSL.
ast_nodes
¶
AST node definitions for the quivers DSL.
The AST is a direct representation of the parsed .qvr source. Each
node carries source-location info for error reporting. Recursive sums
use dx.TaggedUnion with a kind discriminator: variants subclass
their sum's root and pin kind to a Literal[...] value.
TypeExpr
¶
Bases: TaggedUnion
Sum of type-expression node kinds.
CatPattern
¶
Bases: TaggedUnion
Sum of category-pattern node kinds.
CatPatternName
¶
CatPatternSlash
¶
CatPatternProduct
¶
SpaceExpr
¶
Bases: TaggedUnion
Sum of space-expression node kinds.
SpaceConstructor
¶
Expr
¶
Bases: TaggedUnion
Sum of value-expression node kinds (morphism computations).
LetExprNode
¶
Bases: TaggedUnion
Sum of let-step arithmetic expression nodes.
LetExprBinOp
¶
LetExprUnaryOp
¶
LetExprCall
¶
LetExprLiteral
¶
LetExprVar
¶
ProgramStep
¶
Bases: TaggedUnion
Sum of program-block step node kinds.
DrawStep
¶
LetStep
¶
Bases: ProgramStep
A deterministic let binding inside a program block.
The value field always holds a :class:LetExprNode — bare floats
and bare identifier aliases are wrapped in :class:LetExprLiteral and
:class:LetExprVar respectively at parse time.
Statement
¶
Bases: TaggedUnion
Sum of top-level statement kinds.
MorphismDecl
¶
Bases: Statement
Morphism declaration: latent|observed <name> : <dom> -> <cod>.
morphism_kind distinguishes "latent" from "observed";
kind is the dx.TaggedUnion discriminator and is fixed for this
variant.
LetDecl
¶
Bases: Statement
Let binding: let <name> = <expr> [where let_decl+].
The optional where clause carries nested :class:LetDecl
statements; the field is typed as tuple[Statement, ...] (the
union root) because didactic does not yet accept self-referential
forward refs in field annotations. The parser only ever writes
:class:LetDecl instances into the tuple.
Module
¶
Bases: Model
A complete .qvr program (sequence of statements).