Documentation
¶
Overview ¶
Package ast defines the runtime value AST nodes shared across the txcl parser, runtime evaluator, and processor. The package is a leaf — it depends on nothing — so downstream packages (runtime, resonator, processor) can all reference it without creating import cycles when the runtime evaluator (chassis/txcl/runtime) is introduced.
Value is a discriminated sum:
- Literal{V} — a parsed scalar or array literal.
- PathRef{Path} — an `@x.y.z` envelope reference. Reserved for future use; the parser does not produce this node yet (paths on the RHS of SET/EMIT/WITH are not supported in the current grammar).
- FunctionCall{Name,Args} — a `&fn(args...)` runtime call. Reserved; parser does not produce this yet either.
See internal docs/todo-txcl-expressions.md for the broader plan; this package lands the AST shape so the runtime evaluator can be added next without a churn-heavy retrofit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LiteralOrNil ¶
func LiteralOrNil(v Value) interface{}
LiteralOrNil extracts the wrapped value from an ast.Literal, returning nil for any other Value type (including a nil Value). Convenience for transitional code that pre-dates the runtime evaluator — every call site that uses this should ultimately migrate to runtime.Resolve, which handles all three node types.
Types ¶
type FunctionCall ¶
FunctionCall is a `&fn(args...)` runtime call. Resolved by the runtime evaluator through the function registry. Args may include nested FunctionCall nodes (resolution is recursive).
type Literal ¶
type Literal struct {
V interface{}
}
Literal wraps a parsed scalar (string, int64, float64, bool) or array literal ([]interface{}). The underlying type is whatever the parser produced — this struct only carries it, it does not constrain it.