Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/meta-sdk.x
The compiler’s answers to lib/meta.x operations.
Functions
| Function | Summary |
|---|---|
binding_literal_list | Returns values, such as a Lisp-built signature, as a cached literal of the expanding unit. |
binding_native_type | Returns the Func signature of the function syntax syntax. |
builtin_class_location | Returns the location of the active macro invocation. |
builtin_foreach_bindings | Returns an expression reading each binding declaration declares. |
builtin_foreach_collection | Returns the collection foreach iterates for expression, promoting a String literal. |
builtin_foreach_complete | Returns expression with the iterator chain foreach reads completed. |
builtin_foreach_reference | Returns the typed expression naming the function name, or an empty List when no function of that name is visible. |
builtin_foreach_unique | Returns a fresh binding whose spelling starts with stem. |
meta_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. |
meta_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)). |
x2c_binding_spelling | Answers x2c.binding.spelling, declared in lib/meta.x. |
x2c_diagnostic_fail | Answers x2c.diagnostic.fail, 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_function_name | Answers x2c.function.name, declared in lib/meta.x. |
x2c_function_parameter | Answers x2c.function.parameter, 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_literal_value | Answers x2c.literal.value, declared in lib/meta.x. |
x2c_meta_definition_hashes | Answers x2c.meta.definition.hashes, declared in lib/meta.x. |
x2c_method_resolve | Answers x2c.method.resolve, declared in lib/meta.x. |
x2c_protocol_member | Answers x2c.protocol.member, declared in lib/meta.x. |
x2c_source_text | Answers x2c.source.text, declared in lib/meta.x. |
x2c_syntax_type | Answers x2c.syntax.type, declared in lib/meta.x. |
x2c_type_element | Answers x2c.type.element, declared in lib/meta.x. |
x2c_type_fields | Answers x2c.type.fields, declared in lib/meta.x. |
x2c_type_is_integral | Answers x2c.type.integral?, declared in lib/meta.x. |
x2c_type_is_pointer | Answers x2c.type.pointer?, declared in lib/meta.x. |
x2c_type_is_value | Answers x2c.type.value?, declared in lib/meta.x. |
x2c_type_layout | Answers x2c.type.layout, declared in lib/meta.x. |
x2c_type_parameters | Answers x2c.type.parameters, declared in lib/meta.x. |
x2c_type_parts | Answers x2c.type.parts, declared in lib/meta.x. |
x2c_type_resolve | Answers x2c.type.resolve, declared in lib/meta.x. |
x2c_type_return | Answers x2c.type.return, declared in lib/meta.x. |
x2c_type_reverse_name | Answers x2c.type.reverse-name, declared in lib/meta.x. |
x2c_type_tag_name | Answers x2c.type.tag-name, declared in lib/meta.x. |
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.reject | Reports message and notes at the active invocation and never returns, so the rejected operation’s caller cannot continue with a missing answer. |
Functions
binding_literal_list
List binding_literal_list(List values)
Returns values, such as a Lisp-built signature, as a cached literal
of the expanding unit.
Source: src/meta-sdk.x:352
binding_native_type
List binding_native_type(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.x:342
builtin_class_location
List builtin_class_location(void)
Returns the location of the active macro invocation.
Source: src/meta-sdk.x:515
builtin_foreach_bindings
List builtin_foreach_bindings(List declaration)
Returns an expression reading each binding declaration declares.
Source: src/meta-sdk.x:122
builtin_foreach_collection
List builtin_foreach_collection(List expression)
Returns the collection foreach iterates for expression, promoting a
String literal.
Source: src/meta-sdk.x:620
builtin_foreach_complete
List builtin_foreach_complete(List expression)
Returns expression with the iterator chain foreach reads completed.
Source: src/meta-sdk.x:613
builtin_foreach_reference
List builtin_foreach_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.x:150
builtin_foreach_unique
Var builtin_foreach_unique(String stem)
Returns a fresh binding whose spelling starts with stem.
Source: src/meta-sdk.x:294
meta_source_description
List meta_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.x:604
meta_type_description
List meta_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.x:563
x2c_binding_spelling
String x2c_binding_spelling(Var syntax)
Answers x2c.binding.spelling, declared in lib/meta.x.
Source: src/meta-sdk.x:248
x2c_diagnostic_fail
void x2c_diagnostic_fail(String message, List notes)
Answers x2c.diagnostic.fail, declared in lib/meta.x.
Source: src/meta-sdk.x:534
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.x:541
x2c_embed_text
String x2c_embed_text(Var requested)
Answers x2c.embed.text, declared in lib/meta.x.
Source: src/meta-sdk.x:394
x2c_function_name
String x2c_function_name(List function)
Answers x2c.function.name, declared in lib/meta.x.
Source: src/meta-sdk.x:318
x2c_function_parameter
List x2c_function_parameter(List function, String wanted)
Answers x2c.function.parameter, declared in lib/meta.x.
Source: src/meta-sdk.x:325
x2c_ident
List x2c_ident(String spelling)
Answers x2c.ident, declared in lib/meta.x.
Source: src/meta-sdk.x:286
x2c_invocation_column
int x2c_invocation_column(void)
Answers x2c.invocation.column, declared in lib/meta.x.
Source: src/meta-sdk.x:530
x2c_invocation_file
String x2c_invocation_file(void)
Answers x2c.invocation.file, declared in lib/meta.x.
Source: src/meta-sdk.x:522
x2c_invocation_line
int x2c_invocation_line(void)
Answers x2c.invocation.line, declared in lib/meta.x.
Source: src/meta-sdk.x:526
x2c_literal_value
Var x2c_literal_value(Var syntax)
Answers x2c.literal.value, declared in lib/meta.x.
Source: src/meta-sdk.x:492
x2c_meta_definition_hashes
Map x2c_meta_definition_hashes(void)
Answers x2c.meta.definition.hashes, declared in lib/meta.x.
Source: src/meta-sdk.x:303
x2c_method_resolve
List x2c_method_resolve(List type_value, String name)
Answers x2c.method.resolve, declared in lib/meta.x.
Source: src/meta-sdk.x:104
x2c_protocol_member
List x2c_protocol_member(List participant, List base, String member)
Answers x2c.protocol.member, declared in lib/meta.x.
Source: src/meta-sdk.x:89
x2c_source_text
String x2c_source_text(Var value)
Answers x2c.source.text, declared in lib/meta.x.
Source: src/meta-sdk.x:381
x2c_syntax_type
List x2c_syntax_type(List value)
Answers x2c.syntax.type, declared in lib/meta.x.
Source: src/meta-sdk.x:60
x2c_type_element
List x2c_type_element(List value)
Answers x2c.type.element, declared in lib/meta.x.
Source: src/meta-sdk.x:169
x2c_type_fields
List x2c_type_fields(List value)
Answers x2c.type.fields, declared in lib/meta.x.
Source: src/meta-sdk.x:231
x2c_type_is_integral
int x2c_type_is_integral(List value)
Answers x2c.type.integral?, declared in lib/meta.x.
Source: src/meta-sdk.x:162
x2c_type_is_pointer
int x2c_type_is_pointer(List value)
Answers x2c.type.pointer?, declared in lib/meta.x.
Source: src/meta-sdk.x:165
x2c_type_is_value
int x2c_type_is_value(List value)
Answers x2c.type.value?, declared in lib/meta.x.
Source: src/meta-sdk.x:205
x2c_type_layout
List x2c_type_layout(List value)
Answers x2c.type.layout, declared in lib/meta.x.
Source: src/meta-sdk.x:199
x2c_type_parameters
List x2c_type_parameters(List value)
Answers x2c.type.parameters, declared in lib/meta.x.
Source: src/meta-sdk.x:173
x2c_type_parts
List x2c_type_parts(List value)
Answers x2c.type.parts, declared in lib/meta.x.
Source: src/meta-sdk.x:184
x2c_type_resolve
List x2c_type_resolve(List value)
Answers x2c.type.resolve, declared in lib/meta.x.
Source: src/meta-sdk.x:193
x2c_type_return
List x2c_type_return(List value)
Answers x2c.type.return, declared in lib/meta.x.
Source: src/meta-sdk.x:180
x2c_type_reverse_name
String x2c_type_reverse_name(String base, String participant)
Answers x2c.type.reverse-name, declared in lib/meta.x.
Source: src/meta-sdk.x:187
x2c_type_tag_name
Symbol x2c_type_tag_name(String name)
Answers x2c.type.tag-name, declared in lib/meta.x.
Source: src/meta-sdk.x:215
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.x:650
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.x:54
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.x:50
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.x:630
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.x:26
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.