Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/meta-group/meta-group.x
A unit’s meta group, emitted as C.
Functions
| Function | Summary |
|---|---|
Compiler.bind_meta_group | Binds the session’s group function name when it is not bound yet, by staging the group, and reports at site a function that cannot run. |
Compiler.finish_meta_functions | Closes compile-time-only calls across later meta definitions. |
Compiler.group_meta_function | Records a native callable body fn in the unit’s helper group. |
Compiler.groups_meta | Answers whether a meta function or value belongs to the unit’s group: a parse meets it outside a macro definition while the project meta build parses the unit or a session stages it. |
Compiler.meta_call_missing | Returns why the group function name has no compile-time entry, from its type. |
Compiler.meta_calls_wait | Answers whether a call of a project meta function waits for the translation: the project meta build’s own parse has no helper yet. |
Compiler.meta_cc | Returns the C compiler and the runtime header directory that build meta code, or NULL before Compiler.use_meta_toolchain. |
Compiler.meta_cc_identity | Returns the identity of the C compiler at cc: its path and content hash. |
Compiler.meta_cc_run | Runs arguments, a C compiler command building the group C in directory, and returns NULL, or else its first error, which names directory when a group’s C is the cause. |
Compiler.meta_reaches_compile_time | Answers whether a meta body reaches the compiler itself: it names a compile-time-only function or a compiler operation, or constructs a template. |
Compiler.prepare_loaded_functions | Adds a loaded unit’s public functions and object accessors to its targets. |
Compiler.prepare_loaded_main | Exposes a loaded unit’s main through the ordinary helper target table. |
Compiler.public_native_function | Answers whether a definition has public native linkage. |
Compiler.refuse_meta_call | Reports at site that the meta function name cannot run at compile time, and why. |
Compiler.refuse_record_meta_call | Reports at site that the group function name cannot run at compile time when its result is a struct or union, which its type alone decides. |
Compiler.stage_meta_in_process | Enables in-process staging of meta groups for compiler sessions. |
Compiler.stage_session_function | Stages one session factory in an isolated native emission. |
Compiler.use_meta_build_directory | Directs each provider group into directory, using owners to name their headers by table, or stops that when directory is NULL. |
Compiler.use_meta_toolchain | Selects the C compiler cc that builds the meta code of the units this process translates, with the runtime headers this compiler was built with, found from its installed headers in include_dir. |
Compiler.write_meta_build | Writes the group of a unit the project meta build parsed into the build directory as group-K.c and group-K.h, K being its table, with the x2c sources it read in group-K.deps, or its failure in group-K.failure. |
Compiler
Compiler.bind_meta_group
void Compiler.bind_meta_group(Compiler c, String name, Token site)
Binds the session’s group function name when it is not bound yet, by
staging the group, and reports at site a function that cannot run.
Source: src/meta-group/staging.x:54
Compiler.finish_meta_functions
void Compiler.finish_meta_functions(Compiler c, Array nodes)
Closes compile-time-only calls across later meta definitions. Retained group bodies hold the bound calls, including literal insertions. Select runtime definitions only after that relation is complete.
Source: src/meta-group/selection.x:62
Compiler.group_meta_function
void Compiler.group_meta_function(Compiler c, List fn)
Records a native callable body fn in the unit’s helper group.
Source: src/meta-group/selection.x:28
Compiler.groups_meta
int Compiler.groups_meta(Compiler c)
Answers whether a meta function or value belongs to the unit’s group:
a parse meets it outside a macro definition while the project meta build
parses the unit or a session stages it.
Source: src/meta-group/selection.x:18
Compiler.meta_call_missing
String Compiler.meta_call_missing(Compiler c, String name)
Returns why the group function name has no compile-time entry, from
its type.
Source: src/meta-group/selection.x:283
Compiler.meta_calls_wait
int Compiler.meta_calls_wait(Compiler c)
Answers whether a call of a project meta function waits for the
translation: the project meta build’s own parse has no helper yet. A
loaded helper’s parse calls the ordinary helper of its sources.
Source: src/meta-group/selection.x:25
Compiler.meta_cc
String Compiler.meta_cc(String &include_dir)
Returns the C compiler and the runtime header directory that build
meta code, or NULL before Compiler.use_meta_toolchain.
Source: src/meta-group/toolchain.x:31
Compiler.meta_cc_identity
String Compiler.meta_cc_identity(String cc)
Returns the identity of the C compiler at cc: its path and content
hash.
Source: src/meta-group/toolchain.x:38
Compiler.meta_cc_run
String Compiler.meta_cc_run(List arguments, String directory)
Runs arguments, a C compiler command building the group C in
directory, and returns NULL, or else its first error, which names
directory when a group’s C is the cause.
Source: src/meta-group/toolchain.x:47
Compiler.meta_reaches_compile_time
int Compiler.meta_reaches_compile_time(Compiler c, Var node)
Answers whether a meta body reaches the compiler itself: it names a
compile-time-only function or a compiler operation, or constructs a
template. Such a function has no runtime form.
Source: src/meta-group/selection.x:41
Compiler.prepare_loaded_functions
void Compiler.prepare_loaded_functions(Compiler c, Array nodes)
Adds a loaded unit’s public functions and object accessors to its targets. Meta closure must finish first so these entries retain runtime semantics. Existing meta entries and the adapted main keep their original targets.
Source: src/meta-group/loaded.x:79
Compiler.prepare_loaded_main
void Compiler.prepare_loaded_main(Compiler c, Array nodes)
Exposes a loaded unit’s main through the ordinary helper target table. Native calls retain its declared signature; the public argc/argv entry takes an Array of Strings. A renamed main still returns zero on falling through its closing brace. Source text and tokens are unchanged.
Source: src/meta-group/loaded.x:56
Compiler.public_native_function
int Compiler.public_native_function( Compiler c, List function, String name)
Answers whether a definition has public native linkage. Main is excluded because its process entry needs a separate adapter.
Source: src/meta-group/selection.x:273
Compiler.refuse_meta_call
void Compiler.refuse_meta_call( Compiler c, String name, Token site, String why)
Reports at site that the meta function name cannot run at compile
time, and why.
Source: src/meta-group/selection.x:302
Compiler.refuse_record_meta_call
void Compiler.refuse_record_meta_call(Compiler c, String name, Token site)
Reports at site that the group function name cannot run at compile
time when its result is a struct or union, which its type alone
decides.
Source: src/meta-group/selection.x:310
Compiler.stage_meta_in_process
void Compiler.stage_meta_in_process(void)
Enables in-process staging of meta groups for compiler sessions.
Source: src/meta-group/selection.x:13
Compiler.stage_session_function
Map Compiler.stage_session_function( Compiler c, List declarations, Func prepare, String &failure)
Stages one session factory in an isolated native emission. prepare
receives this compiler and returns the factory’s typed definition; it
can place supporting functions through the ordinary compiler APIs.
declarations supplies session types. Returns the loaded module’s
targets, or NULL with failure set. Publishes no evaluator bindings.
Source: src/meta-group/staging.x:92
Compiler.use_meta_build_directory
void Compiler.use_meta_build_directory( String directory, Array owners, Map providers)
Directs each provider group into directory, using owners to name
their headers by table, or stops that when directory is NULL.
Source: src/meta-group/staging.x:13
Compiler.use_meta_toolchain
void Compiler.use_meta_toolchain(String cc, String include_dir)
Selects the C compiler cc that builds the meta code of the units
this process translates, with the runtime headers this compiler was
built with, found from its installed headers in include_dir.
Source: src/meta-group/toolchain.x:9
Compiler.write_meta_build
void Compiler.write_meta_build(Compiler c)
Writes the group of a unit the project meta build parsed into the build
directory as group-K.c and group-K.h, K being its table, with the
x2c sources it read in group-K.deps, or its failure in
group-K.failure. Included native and type providers use the same
group header and object even when they have no meta functions.
Source: src/meta-group/staging.x:27
Design notes
A bodied meta function a project defines runs as native code: in the
project’s helper program, which the project meta build compiles from
each unit’s meta group before translation (meta-project.x), or in a
native module that a session stages in process. This module owns the
group, from the functions it holds to the C it emits.