Skip to main content

Module ast

Module ast 

Source
Expand description

The abstract syntax tree: the typed shape a .vrf source parses into.

Everything here is zero-copy over the source &str (atoms/names borrow their slices) and every node that can be pointed at in an error carries its Span via Located.

Structs§

Atom
An atom is the triple (subject, predicate, object?) — the unit of identity — optionally qualified by a domain (physics.engine has fuel). Creature_A has flying and Creature_A has swimming are DIFFERENT atoms.
Literal
A literal is an atom, optionally negated (NOT ...).
Located
Container for data associated with its source location.
Program
A parsed program: a flat sequence of statements.

Enums§

Body
The body of an PREMISE or RULE.
CloseKind
Which closure a CLOSE statement applies to a relation.
Conn
How the literals in a WHEN/THEN group combine. A single-literal group is always Conn::And (the connective is irrelevant with one literal).
ListOp
List constraint operators (body of a list-style PREMISE).
Quant
A FOR EACH quantifier on a PREMISE/RULE header. It instantiates the premise’s whole body once per element, substituting the binder. The quantifier lives in the header (not the body), so there is exactly one per statement and the body grammar is untouched — a second FOR EACH is structurally unrepresentable, which is what bounds the desugar to a linear number of clauses (no domain products).
Statement
A top-level statement.

Type Aliases§

Span
Source code fragment with line and column tracking.