Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/meta-group.x

A unit’s meta group, emitted as C.

Functions

FunctionSummary
Compiler.bind_meta_groupBinds 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.group_meta_functionRecords the bodied meta function fn in the unit’s group.
Compiler.groups_metaAnswers 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_missingReturns why the group function name has no compile-time entry, from its type.
Compiler.meta_ccReturns the C compiler and the runtime header directory that build meta code, or NULL before Compiler.use_meta_toolchain.
Compiler.meta_cc_identityReturns the identity of the C compiler at cc: its path and content hash.
Compiler.meta_cc_runRuns 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_timeAnswers whether a meta body reaches the compiler itself: it names a compile-time-only function or a compiler operation, or constructs a template.
Compiler.record_meta_importRecords the point where a compile-time import added its meta definitions to the unit, so the group places them where the import stands.
Compiler.refuse_meta_callReports at site that the meta function name cannot run at compile time, and why.
Compiler.refuse_record_meta_callReports 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_processEnables in-process staging of meta groups for compiler sessions.
Compiler.use_meta_build_directoryDirects the group of each unit the project meta build parses into directory, or stops that when it is NULL.
Compiler.use_meta_toolchainSelects 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_buildWrites 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.x:780

Compiler.group_meta_function

void Compiler.group_meta_function(Compiler c, List fn)

Records the bodied meta function fn in the unit’s group.

Source: src/meta-group.x:136

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. A .xmacro import, and each compiler that collects a segment of the unit, shares the unit’s group.

Source: src/meta-group.x:131

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.x:673

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.x:73

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.x:80

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.x:89

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.x:158

Compiler.record_meta_import

void Compiler.record_meta_import(Compiler c)

Records the point where a compile-time import added its meta definitions to the unit, so the group places them where the import stands.

Source: src/meta-group.x:149

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.x:692

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.x:700

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.x:125

Compiler.use_meta_build_directory

void Compiler.use_meta_build_directory(String directory)

Directs the group of each unit the project meta build parses into directory, or stops that when it is NULL.

Source: src/meta-group.x:744

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.x:51

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. A unit without meta functions writes nothing.

Source: src/meta-group.x:752

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.