Std.Syntax (Cure Standard Library v0.37.2)

View Source

The generic quoted-AST value a Tier-3 computed by elab receives and returns (macro-facility design §3, generic layer). Reflects the parser's {tag, meta, third} node: Node for a child list, Leaf for a scalar third value, Raw for a node the parser produced that doesn't fit the {tag, meta, third} shape at all (e.g. a bare impossible-body marker or a non-conforming pattern tuple) -- reflected opaquely rather than crashing. attrs carries the semantic meta (a function's name, an operator, a literal's subtype) — dropping it would lose those. A meta value need not be a plain scalar: SynLit also covers a list of values (SList), a nested AST (SSyntax), and a lookup table (SMap), each losslessly. Source positions are not represented (the expansion is re-elaborated, K3 firewall).

Examples

use Std.Syntax

let expr = call("add", [int_literal(1), variable("x")])
tag(expr)                                # => :function_call
has_tag(expr, :function_call)            # => true

Summary

Types

Shape-specific aliases keep generated family records readable without introducing separate runtime representations or weakening the generic reflection boundary.

Typed declaration specifications keep ordinary macro authors away from positional attribute lists. They are source-level records, so a builder call reads like the declaration it produces and remains reusable by any user-defined macro.

A constructor head extracted from a reflected match arm. The arity is retained in the generic constructor key so source-defined derivations can reject unsupported payload views without compiler-owned domain knowledge.

Functions

Lower an AliasSpec record into a typealias syntax node.

typealias is what the authored surface tags this node with, and the elaborator's header pre-pass keys off it: only a flagged alias gets a forward-referenceable header. Emitting the flag is therefore not cosmetic -- without it a generated alias (Handle, Data in an fsm) is invisible to any declaration lowered before it, including the enclosing unit's own declarations, which module lifting inlines ahead of the generated ones.

Construct an AliasSpec record with name and right-hand side value.

Construct an atom (symbol) literal syntax leaf.

Look up attribute key in values, returning Found(value) or Missing.

Return true when attribute key in values is SAtom(expected).

Construct a key-value Attr entry.

Return the attribute list of syntax (unwrapping Quoted, or [] for Raw and Failure).

Construct a :block syntax node containing items.

Construct a boolean literal syntax leaf.

call is part of the compile-time reflection API. Core-evaluator macro execution must unfold it across the Std.Syntax interface boundary, so its body is semantic interface data rather than an opaque runtime detail.

Name-intent constructors make scope decisions explicit in macro source. caller_identifier deliberately retains the call-site scope; the other two are used for generated references and declaration names respectively.

Extract the parameter name from a reflected :param syntax node, if present.

Convert a reflected parameter node into a typed_pattern, when both name and type are available.

Extract the :type syntax attribute from a reflected parameter node, if present.

Construct a character literal syntax leaf.

Return the child syntax nodes of syntax (empty for Leaf and Raw, [inner] for Quoted).

Collect deduplicated constructor heads from arms, preserving order and failing on invalid arms.

Extract the :constructor_key atom from values, or :invalid_constructor if missing.

Return true when values carries :pascal_case set to true.

Look up one field in the generic staged expansion context.

Derive deduplicated constructor heads from the match arms of a reflected handler body.

Attach user-facing content to an authored diagnostic while keeping its stable failure name in the outer Failure. Presentation adapters consume this record uniformly for source-defined macros.

Select a Unicode-scalar-relative range inside syntax captured from the caller. The compiler validates the range against the captured source span; an invalid or generated target falls back to the macro invocation. Macro authors therefore cannot forge a path or escape the captured syntax.

Construct an enum container syntax node named name with variants.

Construct a nullary enum variant syntax leaf named name.

Build a constructor variant with explicitly typed payload fields. The parser represents enum constructors as function definitions whose params are type expressions, so this is the same surface form as a user-written type Message = Ping(Int) declaration.

Wrap a syntax tree as a successful Expanded MacroResult.

Read the generic staged expansion context attached to reflected syntax. A context-free use site is represented by the same opaque value used for any unavailable syntax, so a source-defined macro can inspect it without relying on a compiler-owned callback record.

Construct an exported-scope identifier syntax leaf.

Construct a float literal syntax leaf.

Mark a generated binder or reference for the parser's existing hygienic freshening pass. Use the marker at each generated occurrence that should share a binding; syntax reflected from the caller remains untouched. The marker is compile-time syntax and disappears before ordinary elaboration; it is not a runtime name generator.

Construct a :function_def syntax node with name, params, return_type, and body.

Build a function whose name is derived from reflected identifier syntax. The generic syntax bridge performs the requested Unicode-safe transform while converting the compile-time Syntax value back to parser AST.

Lower a FunctionSpec record into a :function_def syntax node.

Construct a guarded :match_arm syntax node for pattern when guard -> body.

Return the child nodes of a reflected handler body.

Extract the constructor head from a single unguarded :match_arm syntax node.

Return true when key appears in keys.

Return true when syntax has the given tag expected.

Generic identifier transformations for declaration-producing macros. These inspect reflected identifier syntax only; domain macros decide what generated name means (for example, an actor query adapter).

Lift ordinary primitive values into literal syntax. These constructors are explicit so a string can never be mistaken for an identifier or raw syntax.

Construct an integer literal syntax leaf.

Return true when syntax is a :variable node whose :variable_name attribute equals expected.

Construct a Leaf with tag name, attributes values, and scalar value.

Return the scalar SynLit payload of a Leaf, or SOpaque for any other node kind.

Construct an untyped let assignment syntax node binding name to value.

Construct a :lift_module syntax node for module with behaviour and declarations.

Build a lifted unit that inherits enclosing declarations but not the imports used only to define the surrounding macro. Macro authors can use this when the generated unit declares its complete import surface.

Construct a linear ParameterSpec with name and type kind.

Construct a list literal syntax node from items.

Construct an unguarded :match_arm syntax node for pattern -> body.

Lower a ModuleSpec record into a :lift_module syntax node.

Construct a Node with tag name, attributes values, and children terms.

Construct a function parameter syntax node with name and type kind.

Lower a ParameterSpec record into a :param syntax node.

Construct a linearly graded function parameter syntax node with name and type kind.

Encode a list of parameter syntax nodes as an SList of SSyntax literals.

Build a SynLit list of wildcard ("_") binder names with the same length as items.

Construct a non-linear ParameterSpec with name and type kind.

Lower a list of ParameterSpec records into :param syntax nodes.

Extract a closed constructor head from a reflected match arm. A handler whose head cannot determine a nominal constructor is rejected by the caller rather than silently widening the generated message/event type.

Extract derivable payload type expressions from a constructor pattern's argument list.

Construct a hygienically freshened private identifier syntax leaf.

Reject macro expansion with a single Diagnostic.

Reject macro expansion with a list of Diagnostic values.

Reverse a list of collected pattern-head syntax nodes.

Construct a string literal syntax leaf.

Lift an Atom into a SynLit (SAtom).

Lift a Bool into a SynLit (SBool).

Lift an Int into a SynLit (SInt).

Encode a list of Syntax nodes as an SList of SSyntax literals.

Lift a String into a SynLit (SStr).

Small, total operations used by source-defined syntax macros. These keep syntax analysis in Cure instead of teaching the compiler about a macro's domain-specific declarations.

Construct a tuple expression syntax node from items.

Construct a tuple type syntax node with anonymous binders for items.

Construct a type-annotated let assignment syntax node binding name : kind = value.

Construct a typed pattern syntax node binding name at type kind.

The unit value has a two-tuple parser representation rather than an ordinary expression node. The parser bridge recognizes this reflected marker and restores the canonical () AST before re-elaboration.

Construct a use <name> module import syntax node.

Return true when payload is a derivable type expression (not an opaque Raw node).

Construct a locally scoped variable reference syntax leaf.

Types

struct AliasSpec

 struct AliasSpec
   ?
   ?

enum Attr

 enum Attr
   KV

enum AttrResult

 enum AttrResult
   Found
   Missing

type CasesSyntax

 type CasesSyntax

type CodeSyntax

 type CodeSyntax

type DeclarationsSyntax

 type DeclarationsSyntax

type Diagnostic

 type Diagnostic

type ExpressionSyntax

 type ExpressionSyntax

type FieldsSyntax

 type FieldsSyntax

struct FunctionSpec

 struct FunctionSpec
   ?
   ?
   ?
   ?

enum MacroResult

 enum MacroResult
   Expanded
   Rejected

type ModuleBodySyntax

 type ModuleBodySyntax

type ModuleNameSyntax

 type ModuleNameSyntax

struct ModuleSpec

 struct ModuleSpec
   ?
   ?
   ?

type NameSyntax

 type NameSyntax

Shape-specific aliases keep generated family records readable without introducing separate runtime representations or weakening the generic reflection boundary.

struct ParameterSpec

 struct ParameterSpec
   ?
   ?
   ?

Typed declaration specifications keep ordinary macro authors away from positional attribute lists. They are source-level records, so a builder call reads like the declaration it produces and remains reusable by any user-defined macro.

type ParametersSyntax

 type ParametersSyntax

enum PatternHead

 enum PatternHead
   ValidHead
   InvalidHead

enum PatternHeads

 enum PatternHeads
   Heads
   InvalidHeads

A constructor head extracted from a reflected match arm. The arity is retained in the generic constructor key so source-defined derivations can reject unsupported payload views without compiler-owned domain knowledge.

type PatternSyntax

 type PatternSyntax

enum PayloadTypes

 enum PayloadTypes
   Payloads
   InvalidPayload

type StatementSyntax

 type StatementSyntax

enum SynLit

 enum SynLit
   SInt
   SChar
   SFloat
   SStr
   SBool
   SAtom
   SList
   SSyntax
   SMap
   SOpaque

enum SynPair

 enum SynPair
   SPair

enum Syntax

 enum Syntax
   Node
   Leaf
   Raw
   Quoted
   Failure

type TokenSyntax

 type TokenSyntax

type TypeSyntax

 type TypeSyntax

Functions

alias_from(spec: AliasSpec) -> Syntax

 fn alias_from(spec: AliasSpec) -> Syntax

Lower an AliasSpec record into a typealias syntax node.

alias_node(name: String, rhs: Syntax) -> Syntax

 fn alias_node(name: String, rhs: Syntax) -> Syntax

typealias is what the authored surface tags this node with, and the elaborator's header pre-pass keys off it: only a flagged alias gets a forward-referenceable header. Emitting the flag is therefore not cosmetic -- without it a generated alias (Handle, Data in an fsm) is invisible to any declaration lowered before it, including the enclosing unit's own declarations, which module lifting inlines ahead of the generated ones.

alias_spec(name: String, value: Syntax) -> AliasSpec

 fn alias_spec(name: String, value: Syntax) -> AliasSpec

Construct an AliasSpec record with name and right-hand side value.

atom_literal(value: Atom) -> Syntax

 fn atom_literal(value: Atom) -> Syntax

Construct an atom (symbol) literal syntax leaf.

attr(values: List(Attr), key: Atom) -> AttrResult

 fn attr(values: List(Attr), key: Atom) -> AttrResult

Look up attribute key in values, returning Found(value) or Missing.

attr_atom_is(values: List(Attr), key: Atom, expected: Atom) -> Bool

 fn attr_atom_is(values: List(Attr), key: Atom, expected: Atom) -> Bool

Return true when attribute key in values is SAtom(expected).

attr_value(name: Atom, value: SynLit) -> Attr

 fn attr_value(name: Atom, value: SynLit) -> Attr

Construct a key-value Attr entry.

attrs(syntax: Syntax) -> List(Attr)

 fn attrs(syntax: Syntax) -> List(Attr)

Return the attribute list of syntax (unwrapping Quoted, or [] for Raw and Failure).

block(items: List(Syntax)) -> Syntax

 fn block(items: List(Syntax)) -> Syntax

Construct a :block syntax node containing items.

bool_literal(value: Bool) -> Syntax

 fn bool_literal(value: Bool) -> Syntax

Construct a boolean literal syntax leaf.

call(name: String, args: List(Syntax)) -> Syntax

 fn call(name: String, args: List(Syntax)) -> Syntax

call is part of the compile-time reflection API. Core-evaluator macro execution must unfold it across the Std.Syntax interface boundary, so its body is semantic interface data rather than an opaque runtime detail.

caller_identifier(name: String) -> Syntax

 fn caller_identifier(name: String) -> Syntax

Name-intent constructors make scope decisions explicit in macro source. caller_identifier deliberately retains the call-site scope; the other two are used for generated references and declaration names respectively.

captured_parameter_name(value: Syntax) -> Option(String)

 fn captured_parameter_name(value: Syntax) -> Option(String)

Extract the parameter name from a reflected :param syntax node, if present.

captured_parameter_pattern(value: Syntax) -> Option(Syntax)

 fn captured_parameter_pattern(value: Syntax) -> Option(Syntax)

Convert a reflected parameter node into a typed_pattern, when both name and type are available.

captured_parameter_type(value: Syntax) -> Option(Syntax)

 fn captured_parameter_type(value: Syntax) -> Option(Syntax)

Extract the :type syntax attribute from a reflected parameter node, if present.

char_literal(value: Char) -> Syntax

 fn char_literal(value: Char) -> Syntax

Construct a character literal syntax leaf.

children(syntax: Syntax) -> List(Syntax)

 fn children(syntax: Syntax) -> List(Syntax)

Return the child syntax nodes of syntax (empty for Leaf and Raw, [inner] for Quoted).

collect_pattern_heads(arms: List(Syntax), seen: List(Syntax), keys: List(Atom)) -> PatternHeads

 fn collect_pattern_heads(arms: List(Syntax), seen: List(Syntax), keys: List(Atom)) -> PatternHeads

Collect deduplicated constructor heads from arms, preserving order and failing on invalid arms.

constructor_key(values: List(Attr)) -> Atom

 fn constructor_key(values: List(Attr)) -> Atom

Extract the :constructor_key atom from values, or :invalid_constructor if missing.

constructor_name(values: List(Attr)) -> Bool

 fn constructor_name(values: List(Attr)) -> Bool

Return true when values carries :pascal_case set to true.

context_attr(syntax: Syntax, key: Atom) -> AttrResult

 fn context_attr(syntax: Syntax, key: Atom) -> AttrResult

Look up one field in the generic staged expansion context.

derive_pattern_heads(body: Syntax) -> PatternHeads

 fn derive_pattern_heads(body: Syntax) -> PatternHeads

Derive deduplicated constructor heads from the match arms of a reflected handler body.

diagnostic_details(primary: Syntax, message: String, hint: String) -> Syntax

 fn diagnostic_details(primary: Syntax, message: String, hint: String) -> Syntax

Attach user-facing content to an authored diagnostic while keeping its stable failure name in the outer Failure. Presentation adapters consume this record uniformly for source-defined macros.

diagnostic_subspan(target: Syntax, start: Int, length: Int) -> Syntax

 fn diagnostic_subspan(target: Syntax, start: Int, length: Int) -> Syntax

Select a Unicode-scalar-relative range inside syntax captured from the caller. The compiler validates the range against the captured source span; an invalid or generated target falls back to the macro invocation. Macro authors therefore cannot forge a path or escape the captured syntax.

enum_type(name: String, variants: List(Syntax)) -> Syntax

 fn enum_type(name: String, variants: List(Syntax)) -> Syntax

Construct an enum container syntax node named name with variants.

enum_variant(name: String) -> Syntax

 fn enum_variant(name: String) -> Syntax

Construct a nullary enum variant syntax leaf named name.

enum_variant_payload(name: String, payloads: List(Syntax)) -> Syntax

 fn enum_variant_payload(name: String, payloads: List(Syntax)) -> Syntax

Build a constructor variant with explicitly typed payload fields. The parser represents enum constructors as function definitions whose params are type expressions, so this is the same surface form as a user-written type Message = Ping(Int) declaration.

expand(value: Syntax) -> MacroResult

 fn expand(value: Syntax) -> MacroResult

Wrap a syntax tree as a successful Expanded MacroResult.

expansion_context(syntax: Syntax) -> Syntax

 fn expansion_context(syntax: Syntax) -> Syntax

Read the generic staged expansion context attached to reflected syntax. A context-free use site is represented by the same opaque value used for any unavailable syntax, so a source-defined macro can inspect it without relying on a compiler-owned callback record.

exported_identifier(name: String) -> Syntax

 fn exported_identifier(name: String) -> Syntax

Construct an exported-scope identifier syntax leaf.

float_literal(value: Float) -> Syntax

 fn float_literal(value: Float) -> Syntax

Construct a float literal syntax leaf.

fresh(name: String) -> Syntax

 fn fresh(name: String) -> Syntax

Mark a generated binder or reference for the parser's existing hygienic freshening pass. Use the marker at each generated occurrence that should share a binding; syntax reflected from the caller remains untouched. The marker is compile-time syntax and disappears before ordinary elaboration; it is not a runtime name generator.

function(name: String, params: List(Syntax), return_type: Syntax, body: Syntax) -> Syntax

 fn function(name: String, params: List(Syntax), return_type: Syntax, body: Syntax) -> Syntax

Construct a :function_def syntax node with name, params, return_type, and body.

function_downcase_identifier(identifier: Syntax, params: List(Syntax), return_type: Syntax, body: Syntax) -> Syntax

 fn function_downcase_identifier(identifier: Syntax, params: List(Syntax), return_type: Syntax, body: Syntax) -> Syntax

Build a function whose name is derived from reflected identifier syntax. The generic syntax bridge performs the requested Unicode-safe transform while converting the compile-time Syntax value back to parser AST.

function_from(spec: FunctionSpec) -> Syntax

 fn function_from(spec: FunctionSpec) -> Syntax

Lower a FunctionSpec record into a :function_def syntax node.

guarded_match_arm(pattern: Syntax, guard: Syntax, body: Syntax) -> Syntax

 fn guarded_match_arm(pattern: Syntax, guard: Syntax, body: Syntax) -> Syntax

Construct a guarded :match_arm syntax node for pattern when guard -> body.

handler_children(body: Syntax) -> List(Syntax)

 fn handler_children(body: Syntax) -> List(Syntax)

Return the child nodes of a reflected handler body.

handler_head(arm: Syntax) -> PatternHead

 fn handler_head(arm: Syntax) -> PatternHead

Extract the constructor head from a single unguarded :match_arm syntax node.

has_key(keys: List(Atom), key: Atom) -> Bool

 fn has_key(keys: List(Atom), key: Atom) -> Bool

Return true when key appears in keys.

has_tag(syntax: Syntax, expected: Atom) -> Bool

 fn has_tag(syntax: Syntax, expected: Atom) -> Bool

Return true when syntax has the given tag expected.

identifier_name(value: Syntax) -> Option(String)

 fn identifier_name(value: Syntax) -> Option(String)

Generic identifier transformations for declaration-producing macros. These inspect reflected identifier syntax only; domain macros decide what generated name means (for example, an actor query adapter).

int_literal(value: Int) -> Syntax

 fn int_literal(value: Int) -> Syntax

Lift ordinary primitive values into literal syntax. These constructors are explicit so a string can never be mistaken for an identifier or raw syntax.

integer(value: Int) -> Syntax

 fn integer(value: Int) -> Syntax

Construct an integer literal syntax leaf.

is_variable_named(syntax: Syntax, expected: Atom) -> Bool

 fn is_variable_named(syntax: Syntax, expected: Atom) -> Bool

Return true when syntax is a :variable node whose :variable_name attribute equals expected.

leaf(name: Atom, values: List(Attr), value: SynLit) -> Syntax

 fn leaf(name: Atom, values: List(Attr), value: SynLit) -> Syntax

Construct a Leaf with tag name, attributes values, and scalar value.

leaf_value(syntax: Syntax) -> SynLit

 fn leaf_value(syntax: Syntax) -> SynLit

Return the scalar SynLit payload of a Leaf, or SOpaque for any other node kind.

let_binding(name: String, value: Syntax) -> Syntax

 fn let_binding(name: String, value: Syntax) -> Syntax

Construct an untyped let assignment syntax node binding name to value.

lift_module(module: SynLit, behaviour: Atom, declarations: List(Syntax)) -> Syntax

 fn lift_module(module: SynLit, behaviour: Atom, declarations: List(Syntax)) -> Syntax

Construct a :lift_module syntax node for module with behaviour and declarations.

lift_module_isolated(module: SynLit, behaviour: Atom, declarations: List(Syntax)) -> Syntax

 fn lift_module_isolated(module: SynLit, behaviour: Atom, declarations: List(Syntax)) -> Syntax

Build a lifted unit that inherits enclosing declarations but not the imports used only to define the surrounding macro. Macro authors can use this when the generated unit declares its complete import surface.

linear_parameter_spec(name: String, kind: Syntax) -> ParameterSpec

 fn linear_parameter_spec(name: String, kind: Syntax) -> ParameterSpec

Construct a linear ParameterSpec with name and type kind.

list(items: List(Syntax)) -> Syntax

 fn list(items: List(Syntax)) -> Syntax

Construct a list literal syntax node from items.

match_arm(pattern: Syntax, body: Syntax) -> Syntax

 fn match_arm(pattern: Syntax, body: Syntax) -> Syntax

Construct an unguarded :match_arm syntax node for pattern -> body.

module_from(spec: ModuleSpec) -> Syntax

 fn module_from(spec: ModuleSpec) -> Syntax

Lower a ModuleSpec record into a :lift_module syntax node.

node(name: Atom, values: List(Attr), terms: List(Syntax)) -> Syntax

 fn node(name: Atom, values: List(Attr), terms: List(Syntax)) -> Syntax

Construct a Node with tag name, attributes values, and children terms.

parameter(name: String, kind: Syntax) -> Syntax

 fn parameter(name: String, kind: Syntax) -> Syntax

Construct a function parameter syntax node with name and type kind.

parameter_from(spec: ParameterSpec) -> Syntax

 fn parameter_from(spec: ParameterSpec) -> Syntax

Lower a ParameterSpec record into a :param syntax node.

parameter_linear(name: String, kind: Syntax) -> Syntax

 fn parameter_linear(name: String, kind: Syntax) -> Syntax

Construct a linearly graded function parameter syntax node with name and type kind.

parameter_literals(params: List(Syntax)) -> SynLit

 fn parameter_literals(params: List(Syntax)) -> SynLit

Encode a list of parameter syntax nodes as an SList of SSyntax literals.

parameter_names(items: List(Syntax)) -> SynLit

 fn parameter_names(items: List(Syntax)) -> SynLit

Build a SynLit list of wildcard ("_") binder names with the same length as items.

parameter_spec(name: String, kind: Syntax) -> ParameterSpec

 fn parameter_spec(name: String, kind: Syntax) -> ParameterSpec

Construct a non-linear ParameterSpec with name and type kind.

parameters_from(specs: List(ParameterSpec)) -> List(Syntax)

 fn parameters_from(specs: List(ParameterSpec)) -> List(Syntax)

Lower a list of ParameterSpec records into :param syntax nodes.

pattern_head(pattern: Syntax) -> PatternHead

 fn pattern_head(pattern: Syntax) -> PatternHead

Extract a closed constructor head from a reflected match arm. A handler whose head cannot determine a nominal constructor is rejected by the caller rather than silently widening the generated message/event type.

payload_types(args: List(Syntax)) -> PayloadTypes

 fn payload_types(args: List(Syntax)) -> PayloadTypes

Extract derivable payload type expressions from a constructor pattern's argument list.

private_identifier(name: String) -> Syntax

 fn private_identifier(name: String) -> Syntax

Construct a hygienically freshened private identifier syntax leaf.

reject(diagnostic: Diagnostic) -> MacroResult

 fn reject(diagnostic: Diagnostic) -> MacroResult

Reject macro expansion with a single Diagnostic.

reject_all(diagnostics: List(Diagnostic)) -> MacroResult

 fn reject_all(diagnostics: List(Diagnostic)) -> MacroResult

Reject macro expansion with a list of Diagnostic values.

reverse_heads(items: List(Syntax)) -> List(Syntax)

 fn reverse_heads(items: List(Syntax)) -> List(Syntax)

Reverse a list of collected pattern-head syntax nodes.

reverse_heads_acc(items: List(Syntax), acc: List(Syntax)) -> List(Syntax)

 fn reverse_heads_acc(items: List(Syntax), acc: List(Syntax)) -> List(Syntax)

Tail-recursive accumulator helper for reverse_heads/1.

string_literal(value: String) -> Syntax

 fn string_literal(value: String) -> Syntax

Construct a string literal syntax leaf.

syntax_atom(value: Atom) -> SynLit

 fn syntax_atom(value: Atom) -> SynLit

Lift an Atom into a SynLit (SAtom).

syntax_bool(value: Bool) -> SynLit

 fn syntax_bool(value: Bool) -> SynLit

Lift a Bool into a SynLit (SBool).

syntax_int(value: Int) -> SynLit

 fn syntax_int(value: Int) -> SynLit

Lift an Int into a SynLit (SInt).

syntax_list(items: List(Syntax)) -> SynLit

 fn syntax_list(items: List(Syntax)) -> SynLit

Encode a list of Syntax nodes as an SList of SSyntax literals.

syntax_string(value: String) -> SynLit

 fn syntax_string(value: String) -> SynLit

Lift a String into a SynLit (SStr).

tag(syntax: Syntax) -> Atom

 fn tag(syntax: Syntax) -> Atom

Small, total operations used by source-defined syntax macros. These keep syntax analysis in Cure instead of teaching the compiler about a macro's domain-specific declarations.

tuple(items: List(Syntax)) -> Syntax

 fn tuple(items: List(Syntax)) -> Syntax

Construct a tuple expression syntax node from items.

tuple_type(items: List(Syntax)) -> Syntax

 fn tuple_type(items: List(Syntax)) -> Syntax

Construct a tuple type syntax node with anonymous binders for items.

typed_let_binding(name: String, kind: Syntax, value: Syntax) -> Syntax

 fn typed_let_binding(name: String, kind: Syntax, value: Syntax) -> Syntax

Construct a type-annotated let assignment syntax node binding name : kind = value.

typed_pattern(name: String, kind: Syntax) -> Syntax

 fn typed_pattern(name: String, kind: Syntax) -> Syntax

Construct a typed pattern syntax node binding name at type kind.

unit_literal() -> Syntax

 fn unit_literal() -> Syntax

The unit value has a two-tuple parser representation rather than an ordinary expression node. The parser bridge recognizes this reflected marker and restores the canonical () AST before re-elaboration.

use_module(name: String) -> Syntax

 fn use_module(name: String) -> Syntax

Construct a use <name> module import syntax node.

valid_payload_type(payload: Syntax) -> Bool

 fn valid_payload_type(payload: Syntax) -> Bool

Return true when payload is a derivable type expression (not an opaque Raw node).

variable(name: String) -> Syntax

 fn variable(name: String) -> Syntax

Construct a locally scoped variable reference syntax leaf.