Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/literals.x
X2c literal and lambda parsing.
Functions
| Function | Summary |
|---|---|
Compiler.begin_lambda_captures | Opens lexical capture resolution while a lambda body is parsed or bound. |
Compiler.bind_lambda_expression | Binds a constructed lambda through the lexical capture operations used by source literals. |
Compiler.capture_lambda_identifier | Resolves an automatic identifier through each enclosing lambda’s captures. |
Compiler.end_lambda_captures | Finishes the active lambda’s captures in first-use order. |
Compiler.lambda_capture_required | Reports whether the active lambda still needs to capture a binding. |
Compiler.parse_array_literal | Parses a quoted Array literal into a typed, source-ordered (array ...) node and consumes its closing ]. |
Compiler.parse_atomic_literal | Parses the current atomic token into a typed expression and advances once. |
Compiler.parse_catch_pattern_literal | Parses a filtered-catch %() payload into a typed List pattern. |
Compiler.parse_lambda_literal | Parses a %!(...) => ... literal and returns its typed lambda expression. |
Compiler.parse_list_literal | Parses a List literal beginning at ( or %( and returns its typed expression after consuming ). |
Compiler.parse_map_entries | Parses comma-separated Map entries up to but not including }. |
Compiler.parse_map_entry | Parses one Map entry without consuming its following comma or }. |
Compiler.parse_map_literal | Parses a quoted Map literal into a typed, source-ordered (map ...) node and consumes its closing }. |
Compiler.parse_raise_literal | Parses the %() payload following raise into a (raise CODE (args ...)) node and consumes its closing ). |
Compiler.parse_string_literal | Parses a percent String literal and returns its typed expression after the closing quote. |
Compiler.parse_symbol_set_literal | Parses a %<<...>> literal into an immutable ordered SymbolSet. |
Compiler.symbol_set_expression | Builds a typed SymbolSet expression from source-ordered Symbol values. |
Compiler
Compiler.begin_lambda_captures
void Compiler.begin_lambda_captures( Compiler c, List references, List supplied)
Opens lexical capture resolution while a lambda body is parsed or bound.
references names explicitly shared surrounding bindings; supplied
contains canonical capture rows supplied by constructed syntax. Evolving
rows live in semantic binding facts so macro transactions restore them.
Source: src/literals.x:820
Compiler.bind_lambda_expression
List Compiler.bind_lambda_expression( Compiler c, Type type, List parameters, List supplied, List body)
Binds a constructed lambda through the lexical capture operations used by source literals. Parameter declarations keep their existing declarators; supplied canonical capture rows retain their value or reference mode.
Source: src/literals.x:921
Compiler.capture_lambda_identifier
List Compiler.capture_lambda_identifier( Compiler c, List binding, Type type)
Resolves an automatic identifier through each enclosing lambda’s captures. Fresh captured bindings keep sibling snapshots independent of shared-cell rewriting. Reference captures preserve qualifiers; snapshots of reference parameters copy their current referents.
Source: src/literals.x:846
Compiler.end_lambda_captures
List Compiler.end_lambda_captures(Compiler c)
Finishes the active lambda’s captures in first-use order.
Source: src/literals.x:829
Compiler.lambda_capture_required
int Compiler.lambda_capture_required(Compiler c, List binding)
Reports whether the active lambda still needs to capture a binding.
Source: src/literals.x:804
Compiler.parse_array_literal
List Compiler.parse_array_literal(Compiler compiler)
Parses a quoted Array literal into a typed, source-ordered (array ...)
node and consumes its closing ].
Source: src/literals.x:520
Compiler.parse_atomic_literal
List Compiler.parse_atomic_literal(Compiler c)
Parses the current atomic token into a typed expression and advances once. Pattern and macro-hole state control binder validation and quoting, while shallow parsing permits provisional numeric types.
Source: src/literals.x:1096
Compiler.parse_catch_pattern_literal
List Compiler.parse_catch_pattern_literal(Compiler c)
Parses a filtered-catch %() payload into a typed List pattern.
The call consumes the closing ). A bare code Symbol may be followed by
* patterns or (key pattern) pairs; pattern and runtime-literal state is
restored on success.
Source: src/literals.x:453
Compiler.parse_lambda_literal
List Compiler.parse_lambda_literal(Compiler c)
Parses a %!(...) => ... literal and returns its typed lambda expression.
Parameter bindings are in a new Sym scope, block bodies use Var as the
active return type, and capture rows come from semantic_binding_facts.
Capturing lambdas have type Func; noncapturing lambdas retain a native
function type.
Source: src/literals.x:1001
Compiler.parse_list_literal
List Compiler.parse_list_literal(Compiler c)
Parses a List literal beginning at ( or %( and returns its typed
expression after consuming ). Pattern parsing sets and restores
match_is; runtime_literals disables stable-cell caching.
Source: src/literals.x:185
Compiler.parse_map_entries
List Compiler.parse_map_entries(Compiler c)
Parses comma-separated Map entries up to but not including }.
Entry-position macro sequences are flattened in source order.
Source: src/literals.x:552
Compiler.parse_map_entry
List Compiler.parse_map_entry(Compiler compiler)
Parses one Map entry without consuming its following comma or }.
A direct row returns a resolved (map-entry KEY VALUE) node; an
entry-position macro may return (seq ...) for its caller to splice.
Source: src/literals.x:531
Compiler.parse_map_literal
List Compiler.parse_map_literal(Compiler compiler)
Parses a quoted Map literal into a typed, source-ordered (map ...) node
and consumes its closing }.
Source: src/literals.x:609
Compiler.parse_raise_literal
List Compiler.parse_raise_literal(Compiler c)
Parses the %() payload following raise into a (raise CODE (args ...))
node and consumes its closing ). The code and detail keys must be bare
Symbols, each keyed detail has one value, and payload literals bypass the
compiler cache.
Source: src/literals.x:402
Compiler.parse_string_literal
List Compiler.parse_string_literal(Compiler compiler)
Parses a percent String literal and returns its typed
expression after the
closing quote. Static segments enter the compiler cache unless
runtime_literals is set; interpolated segments remain source ordered.
Source: src/literals.x:707
Compiler.parse_symbol_set_literal
List Compiler.parse_symbol_set_literal(Compiler c)
Parses a %<<...>> literal into an immutable ordered SymbolSet.
Entries must be literal compact Symbols; source order defines dense
indexes
and an equal encoded Symbol reports a duplicate diagnostic.
Source: src/literals.x:352
Compiler.symbol_set_expression
List Compiler.symbol_set_expression( Compiler compiler, List values, int *duplicate)
Builds a typed SymbolSet expression from source-ordered Symbol values.
Stores the first duplicate index, or -1, through duplicate; a duplicate
returns NULL.
Source: src/literals.x:336
Design notes
Parses List, Array, Map, interpolated String, and lambda literals.
Stable
List cells and String segments are cached only when they contain no
dynamic references. Lambda bodies are expressions or blocks;
parameters may use typed declarations or bare identifiers, and lexical
automatic values are recorded for captured Func lowering.