ast

The self-hosted parser's typed AST (ADR 0043 stage 2). Parse results are the frontend's real product — the dump renderer in Dump.tlk is only the validation view of this tree. Nodes carry byte spans; kinds and child field order mirror the reference node kinds so the rendered tree lines up with the frozen dump format. Coverage grows with the parser: kinds appear here as their grammar lands.

Nodes are plain values ('heap references cannot sit in array storage), so self-recursive expression links go through arrays, exactly like the lexer's token trees: binary carries [lhs, rhs], call carries its callee as a one-element array.

API Reference

Structs

struct MetaToken

A token carried in node meta (ADR 0043 option A): the reference token shape with line/col stamped at the token's END (0-based line, character-counted column, reset on newline).

struct NodeMeta

The reference NodeMeta: a node's first and last tokens plus the identifier tokens consumed while the node's frame was open. A start < 0 on start marks a synthesized node carrying no meta.

struct EffectSet

A function type's declared effect row ('[io], 'io, or the open default). Not rendered in the dump; carried for the real product.

struct StaticExpr

A static-value expression and its source range.

struct TypeAnnotation

A parsed type annotation with a half-open UTF-8 byte range.

struct Parameter

A declared parameter — function, init, effect, or block argument. Mirrors the reference quirk: the span starts AFTER the name (the reference pushes its source location once the name is consumed); the name's own span rides along for the for-loop block-arg replacement.

struct CaptureSpec

One explicitly declared closure capture.

struct GenericDecl

A declared generic parameter (T: Proto = Default, or the ADR 0035 static form static N: Int whose declared value type is static_ty).

struct WhereClause

The ordered generic constraints in a where clause.

struct Func

A named function used by declarations, methods, and function expressions.

struct Body

A nominal declaration's member list.

struct TypeApplication

An extension head (extend Name<Args>): a name plus arguments only.

struct MatchArm

One pattern -> body arm of a match. Desugared conditionals (if-let) synthesize arms with no source span.

struct Block

An executable block with optional leading parameters and ordered items.

struct MacroToken

A flattened canonical token carried by a macro invocation. Flattening the ranges keeps the parse-result ABI simple; no token text is reconstructed.

struct IRInstruction

One #_ir instruction: its name, optional destination register lexeme (? requests a fresh one), optional operand type, value operands in instruction order, and the cmp comparator.

struct RecordField

A labeled field in a record expression.

struct Expr

A parsed expression with unresolved names and a half-open byte range.

struct CallArg

A call argument with source label, ownership mode, and expression value.

struct Pattern

A parsed binding or matching pattern with unresolved names.

struct MacroParam

A macro's $param; the span includes the sigil.

struct ImportedSymbol

A symbol selected by an import and its optional local alias.

struct Import

A parsed module import.

struct Decl

A parsed declaration with file-interface visibility and source range.

struct Stmt

A parsed statement and its source range.

Enums

enum GenericArg

A type-level or static-value argument in a generic application.

enum StaticOpKind

The arithmetic operators permitted in static-value expressions.

enum StaticExprKind

The ADR 0035 static index language (16, N + 1, (M) * 2, .on). Not a dump-visited node: only nested Path annotations render, at the surrounding depth.

enum TypeAnnotationKind

The grammar form and recursively parsed components of a type annotation.

enum ParamMode

A parameter's ownership mode (ADR 0018); none = unadorned (defaulting is decided during desugaring).

enum ParamLabel

A parameter's external argument label (ADR 0041); none = a bare, positional binder. A one-name colon form stores named(binder).

enum CaptureMode

How an explicit closure capture obtains access to its source binding.

enum ArgMode

An ownership marker on a for-loop's iterable (ADR 0021): consume xs iterates by moving, mut xs by exclusive borrow.

enum ExprKind

The grammar form and child nodes of a parsed expression.

enum IRValue

An inline-IR value operand.

enum PatternKind

The grammar form and child nodes of a parsed pattern.

enum ImportedSymbols

Selects which symbols an import introduces into local scope.

enum DeclKind

The grammar form and children of a parsed declaration.

enum StmtKind

The grammar form and child nodes of a parsed statement.

enum Item

A root or block child produced by one parser category.

Functions