Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/meta-sdk/meta-sdk.x
The compiler’s answers to lib/meta.x operations.
Functions
| Function | Summary |
|---|---|
x2c_binding_for | Answers x2c.binding.for, declared in lib/meta.x. |
x2c_binding_fresh | Answers x2c.binding.fresh, declared in lib/meta.x. |
x2c_diagnostic_error_at | Answers x2c.diagnostic.error.at, declared in lib/meta.x. |
x2c_diagnostic_fail | Answers x2c.diagnostic.fail, declared in lib/meta.x. |
x2c_diagnostic_fail_at | Answers x2c.diagnostic.fail.at, declared in lib/meta.x. |
x2c_diagnostic_warn | A warning reports where it is raised and returns, so a macro can keep expanding. |
x2c_embed_text | Answers x2c.embed.text, declared in lib/meta.x. |
x2c_enclosing | Answers x2c.enclosing, declared in lib/meta.x. |
x2c_ident | Answers x2c.ident, declared in lib/meta.x. |
x2c_invocation_column | Answers x2c.invocation.column, declared in lib/meta.x. |
x2c_invocation_file | Answers x2c.invocation.file, declared in lib/meta.x. |
x2c_invocation_line | Answers x2c.invocation.line, declared in lib/meta.x. |
x2c_meta_definition_hashes | Answers x2c.meta.definition.hashes, declared in lib/meta.x. |
x2c_place | Answers x2c.place, declared in lib/meta.x. |
Code.arguments | Answers Code.arguments, declared in lib/meta.x. |
Code.binding_spelling | Answers Code.binding_spelling, declared in lib/meta.x. |
Code.body | Answers Code.body, declared in lib/meta.x. |
Code.bound | Answers Code.bound, declared in lib/meta.x, with the carrier Compiler.take_code_value consumes. |
Code.call_in_order | Answers Code.call_in_order, declared in lib/meta.x. |
Code.convert | Answers Code.convert, declared in lib/meta.x. |
Code.declared_bindings | Returns an expression reading each binding declaration declares. |
Code.exits | Answers Code.exits, declared in lib/meta.x. |
Code.format | Answers Code.format, declared in lib/meta.x. |
Code.func_parameters | Answers Code.func_parameters, declared in lib/meta.x. |
Code.is_static_pattern | Answers Code.is_static_pattern, declared in lib/meta.x. |
Code.lowered | Answers Code.lowered, declared in lib/meta.x, with the carrier Compiler.take_code_value consumes. |
Code.name | Answers Code.name, declared in lib/meta.x. |
Code.native_signature | Returns the Func signature of the function syntax syntax. |
Code.parameter | Answers Code.parameter, declared in lib/meta.x. |
Code.pattern_value | Answers Code.pattern_value, declared in lib/meta.x. |
Code.promoted | Answers Code.promoted, declared in lib/meta.x. |
Code.register_after_initialization | Adds post-initialization block items while the declaration owner retains the original declarators, their type identity, and initialization order. |
Code.register_rewrite | Answers Code.register_rewrite, declared in lib/meta.x: the pattern’s form selects the family and its keys. |
Code.source_text | Answers Code.source_text, declared in lib/meta.x. |
Code.type | Answers the compiler-backed captured-code type query. |
Code.value | Reads a constant through the compiler’s existing constant decoder. |
Compiler.bind_sdk_primitives | Binds the internal primitives the compile-time SDK library wraps into lisp, under their _x2c. names. |
Compiler.expanding | Returns the compiler running the current compile-time call. |
MetaContext.current | Returns the context of the running compile-time call, which an evaluation changes with $let for its own extent. |
MetaContext.fresh_binding | Returns a fresh binding whose spelling starts with stem. |
MetaContext.function_reference | Returns the typed expression naming the function name, or an empty List when no function of that name is visible. |
MetaContext.invocation_location | Returns the location of the active macro invocation. |
MetaContext.literal_list | Returns values, such as a Lisp-built signature, as a cached literal of the expanding unit. |
MetaContext.reject | Reports message and notes at the active invocation and never returns, so the rejected operation’s caller cannot continue with a missing answer. |
MetaContext.source_description | Returns what a meta parameter declared Source receives for the captured syntax value: ((text T) (file F) (syntax value)), where T is the text the developer wrote and F the file it is in. |
MetaContext.type_description | Returns what a meta parameter declared TypeInfo receives for the captured syntax value: ((name N) (kind K) (type T) (fields F) (methods M)). |
Type.aggregate | Answers Type.aggregate, declared in lib/meta.x. |
Type.element | Answers Type.element, declared in lib/meta.x. |
Type.fields | Answers Type.fields, declared in lib/meta.x. |
Type.getter | Answers Type.getter, declared in lib/meta.x, with the getter that bracket admission selected. |
Type.is_named | Tests type ancestry through the active symbol table. |
Type.is_text | Tests the text forms accepted by string arithmetic. |
Type.is_value | Answers Type.is_value, declared in lib/meta.x. |
Type.layout | Answers Type.layout, declared in lib/meta.x. |
Type.marked_fields | Answers Type.marked_fields, declared in lib/meta.x. |
Type.members | Answers Type.members, declared in lib/meta.x. |
Type.numeric | Resolves numeric typedefs through the active symbol table. |
Type.parameters | Answers Type.parameters, declared in lib/meta.x. |
Type.protocol_member | Selects a callable protocol member in the current compilation context. |
Type.resolve | Answers Type.resolve, declared in lib/meta.x. |
Type.resolve_member | Answers Type.resolve_member, declared in lib/meta.x. |
Type.return_type | Answers Type.return_type, declared in lib/meta.x. |
Type.reverse_name | Answers Type.reverse_name, declared in lib/meta.x. |
Type.tag_name | Answers Type.tag_name, declared in lib/meta.x. |
Type.update_helper | Answers Type.update_helper, declared in lib/meta.x. |
Functions
x2c_binding_for
List x2c_binding_for(Var key, String role)
Answers x2c.binding.for, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:245
x2c_binding_fresh
List x2c_binding_fresh(String role)
Answers x2c.binding.fresh, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:237
x2c_diagnostic_error_at
void x2c_diagnostic_error_at( Var node, Symbol category, String message, List notes)
Answers x2c.diagnostic.error.at, declared in lib/meta.x.
Source: src/meta-sdk/context.x:68
x2c_diagnostic_fail
void x2c_diagnostic_fail(String message, List notes)
Answers x2c.diagnostic.fail, declared in lib/meta.x.
Source: src/meta-sdk/context.x:54
x2c_diagnostic_fail_at
void x2c_diagnostic_fail_at( Var node, Symbol category, String message, List notes)
Answers x2c.diagnostic.fail.at, declared in lib/meta.x.
Source: src/meta-sdk/context.x:60
x2c_diagnostic_warn
void x2c_diagnostic_warn(String message, List notes)
A warning reports where it is raised and returns, so a macro can keep expanding. Failure stays separate because it never returns.
Source: src/meta-sdk/context.x:77
x2c_embed_text
String x2c_embed_text(Var requested)
Answers x2c.embed.text, declared in lib/meta.x.
Source: src/meta-sdk/sources.x:53
x2c_enclosing
Code x2c_enclosing(Symbol what)
Answers x2c.enclosing, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:318
x2c_ident
List x2c_ident(String spelling)
Answers x2c.ident, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:229
x2c_invocation_column
int x2c_invocation_column(void)
Answers x2c.invocation.column, declared in lib/meta.x.
Source: src/meta-sdk/context.x:50
x2c_invocation_file
String x2c_invocation_file(void)
Answers x2c.invocation.file, declared in lib/meta.x.
Source: src/meta-sdk/context.x:42
x2c_invocation_line
int x2c_invocation_line(void)
Answers x2c.invocation.line, declared in lib/meta.x.
Source: src/meta-sdk/context.x:46
x2c_meta_definition_hashes
Map x2c_meta_definition_hashes(void)
Answers x2c.meta.definition.hashes, declared in lib/meta.x.
Source: src/meta-sdk/primitives.x:22
x2c_place
void x2c_place(List where, Code code)
Answers x2c.place, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:326
Code
Code.arguments
List Code.arguments(Code parameters)
Answers Code.arguments, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:278
Code.binding_spelling
String Code.binding_spelling(Var syntax)
Answers Code.binding_spelling, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:191
Code.body
List Code.body(Code function)
Answers Code.body, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:272
Code.bound
Code Code.bound(Code c, List effects)
Answers Code.bound, declared in lib/meta.x, with the carrier
Compiler.take_code_value consumes.
Source: src/meta-sdk/syntax.x:103
Code.call_in_order
Code Code.call_in_order(Code member, List arguments, Type type)
Answers Code.call_in_order, declared in lib/meta.x. The call binds
its temporaries here, so the result is a carrier that binds no
further.
Source: src/meta-sdk/syntax.x:91
Code.convert
Code Code.convert(Code value, Type target)
Answers Code.convert, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:118
Code.declared_bindings
List Code.declared_bindings(List declaration)
Returns an expression reading each binding declaration declares.
Source: src/meta-sdk/syntax.x:151
Code.exits
int Code.exits(Code statement)
Answers Code.exits, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:112
Code.format
String Code.format(Code value)
Answers Code.format, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:124
Code.func_parameters
List Code.func_parameters(Code parameters, Code fn, Code argv)
Answers Code.func_parameters, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:106
Code.is_static_pattern
int Code.is_static_pattern(Code pattern)
Answers Code.is_static_pattern, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:130
Code.lowered
Code Code.lowered(Code c, List effects)
Answers Code.lowered, declared in lib/meta.x, with the carrier
Compiler.take_code_value consumes.
Source: src/meta-sdk/syntax.x:99
Code.name
String Code.name(Code function)
Answers Code.name, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:265
Code.native_signature
List Code.native_signature(List syntax)
Returns the Func signature of the function syntax syntax. A native
binding stores the same signature as an ordinary Func adapter.
Source: src/meta-sdk/syntax.x:307
Code.parameter
Code Code.parameter(Code function, String wanted)
Answers Code.parameter, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:290
Code.pattern_value
Var Code.pattern_value(Code pattern)
Answers Code.pattern_value, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:136
Code.promoted
Code Code.promoted(Code value)
Answers Code.promoted, declared in lib/meta.x.
Source: src/meta-sdk/syntax.x:142
Code.register_after_initialization
Code Code.register_after_initialization(Code c, Macro shape, List holes)
Adds post-initialization block items while the declaration owner retains the original declarators, their type identity, and initialization order.
Source: src/meta-sdk/rewrites.x:170
Code.register_rewrite
Code Code.register_rewrite(Code function, List pattern, List holes)
Answers Code.register_rewrite, declared in lib/meta.x: the
pattern’s form selects the family and its keys. A function rule is
keyed by return type, which Compiler.normalize dispatches once per
definition before its body lowers.
Source: src/meta-sdk/rewrites.x:106
Code.source_text
String Code.source_text(Var value)
Answers Code.source_text, declared in lib/meta.x.
Source: src/meta-sdk/sources.x:40
Code.type
Type Code.type(Code value)
Answers the compiler-backed captured-code type query.
Source: src/meta-sdk/syntax.x:49
Code.value
Var Code.value(Code code)
Reads a constant through the compiler’s existing constant decoder.
Source: src/meta-sdk/syntax.x:75
Compiler
Compiler.bind_sdk_primitives
void Compiler.bind_sdk_primitives(Lisp lisp)
Binds the internal primitives the compile-time SDK library wraps into
lisp, under their _x2c. names.
Source: src/meta-sdk/primitives.x:87
Compiler.expanding
Compiler Compiler.expanding(void)
Returns the compiler running the current compile-time call. A slot function compiled into the compiler reads its facts through it.
Source: src/meta-sdk/context.x:29
MetaContext
MetaContext.current
MetaContext *MetaContext.current(void)
Returns the context of the running compile-time call, which an
evaluation changes with $let for its own extent.
Source: src/meta-sdk/context.x:25
MetaContext.fresh_binding
Var MetaContext.fresh_binding(String stem)
Returns a fresh binding whose spelling starts with stem.
Source: src/meta-sdk/syntax.x:256
MetaContext.function_reference
List MetaContext.function_reference(String name)
Returns the typed expression naming the function name, or an empty
List when no function of that name is visible. This reads the symbol
table only, so any compile-time Lisp evaluation may call it, including
one outside a macro expansion.
Source: src/meta-sdk/syntax.x:179
MetaContext.invocation_location
List MetaContext.invocation_location(void)
Returns the location of the active macro invocation.
Source: src/meta-sdk/context.x:35
MetaContext.literal_list
List MetaContext.literal_list(List values)
Returns values, such as a Lisp-built signature, as a cached literal
of the expanding unit.
Source: src/meta-sdk/primitives.x:57
MetaContext.reject
void MetaContext.reject(String message, List notes)
Reports message and notes at the active invocation and never
returns, so the rejected operation’s caller cannot continue with a
missing answer. With no active invocation it is a bad state.
Source: src/meta-sdk/context.x:95
MetaContext.source_description
List MetaContext.source_description(Var value)
Returns what a meta parameter declared Source receives for the
captured syntax value: ((text T) (file F) (syntax value)), where T
is the text the developer wrote and F the file it is in.
Source: src/meta-sdk/sources.x:153
MetaContext.type_description
List MetaContext.type_description(Var value)
Returns what a meta parameter declared TypeInfo receives for the
captured syntax value: ((name N) (kind K) (type T) (fields F) (methods M)).
T is the canonical type of value and N its name, or “” when it has
none. K is struct, union, enum, pointer, scalar, or other,
F lists the (name type) rows of a struct or union’s named fields,
and M the names of its direct dotted methods.
Source: src/meta-sdk/types.x:192
Type
Type.aggregate
Type Type.aggregate(Type type)
Answers Type.aggregate, declared in lib/meta.x.
Source: src/meta-sdk/types.x:40
Type.element
Type Type.element(Type t)
Answers Type.element, declared in lib/meta.x.
Source: src/meta-sdk/types.x:89
Type.fields
List Type.fields(Type t)
Answers Type.fields, declared in lib/meta.x.
Source: src/meta-sdk/types.x:170
Type.getter
Code Type.getter(Type type)
Answers Type.getter, declared in lib/meta.x, with the getter that
bracket admission selected.
Source: src/meta-sdk/types.x:69
Type.is_named
int Type.is_named(Type type, String name)
Tests type ancestry through the active symbol table.
Source: src/meta-sdk/types.x:21
Type.is_text
int Type.is_text(Type type)
Tests the text forms accepted by string arithmetic.
Source: src/meta-sdk/types.x:33
Type.is_value
int Type.is_value(Type type)
Answers Type.is_value, declared in lib/meta.x.
Source: src/meta-sdk/types.x:121
Type.layout
List Type.layout(Type type)
Answers Type.layout, declared in lib/meta.x.
Source: src/meta-sdk/types.x:115
Type.marked_fields
List Type.marked_fields(Type aggregate, Symbol mark)
Answers Type.marked_fields, declared in lib/meta.x.
Source: src/meta-sdk/types.x:46
Type.members
List Type.members(Type type)
Answers Type.members, declared in lib/meta.x.
Source: src/meta-sdk/types.x:147
Type.numeric
Type Type.numeric(Type type)
Resolves numeric typedefs through the active symbol table.
Source: src/meta-sdk/types.x:27
Type.parameters
List Type.parameters(Type type)
Answers Type.parameters, declared in lib/meta.x.
Source: src/meta-sdk/types.x:92
Type.protocol_member
Code Type.protocol_member(Type type, String name)
Selects a callable protocol member in the current compilation context. The member’s own implementation receives no recursive selection.
Source: src/meta-sdk/types.x:59
Type.resolve
Type Type.resolve(Type type)
Answers Type.resolve, declared in lib/meta.x.
Source: src/meta-sdk/types.x:109
Type.resolve_member
List Type.resolve_member(Type type, String name, int call)
Answers Type.resolve_member, declared in lib/meta.x.
Source: src/meta-sdk/types.x:52
Type.return_type
Type Type.return_type(Type type)
Answers Type.return_type, declared in lib/meta.x.
Source: src/meta-sdk/types.x:99
Type.reverse_name
String Type.reverse_name(String base, String participant)
Answers Type.reverse_name, declared in lib/meta.x.
Source: src/meta-sdk/types.x:103
Type.tag_name
Symbol Type.tag_name(String name)
Answers Type.tag_name, declared in lib/meta.x.
Source: src/meta-sdk/types.x:131
Type.update_helper
String Type.update_helper(Type type)
Answers Type.update_helper, declared in lib/meta.x.
Source: src/meta-sdk/types.x:80
Public types
| Type | Kind | Summary |
|---|---|---|
MetaContext | struct | What the running compile-time call answers from. |
MetaContext
typedef struct MetaContext { Compiler expander, evaluator; String definition_file; Map captures; int has_bindings; Token site; } MetaContext
What the running compile-time call answers from. expander is the
compiler of the active macro expansion, definition_file the source of
its definition, captures its complete captured syntax by identity, and
has_bindings whether it bound captured values. evaluator is the
compiler evaluating Lisp and site where that evaluation stands, which
a nested import changes without an expansion. Each evaluation installs
its part with $let, so a captured entry is valid only while its
expansion is active.
Source: src/meta-sdk/meta-sdk.x:25
Design notes
Compile-time code asks the compiler about syntax, types, names, and
source through the operations lib/meta.x declares, and the built-in
macros ask through their own entries here. A native operation has no
Compiler parameter, so each answer reads the running call’s
MetaContext, which the evaluations in macros.x install for their
extent. An operation that cannot answer reports at the active
invocation and never returns.