Native code compiler: JIT assembler (default) with C compiler fallback.
Default compile uses JIT assembler. compile-c falls back to C compiler. compile-asm is the pure JIT path.
A module of its own: every name here is reached with (import x/tool/compile NAME); compile-with-writers, compile-emitters and compile-add-emitter! are re-exported from x/tool/compile/pipeline and x/tool/compile/emit.
compile-hosted?Whether this engine ships the C headers the cc lane compiles against; the tower’s JIT probe reads it to choose between compiling and keeping the interpreted twin.
Returns: BOOL — #t when engine/include and engine/ext/x-expr/include exist
compile-to-cGenerate C source code from an (fn …) expression.
Parameters:
LIST — A (fn (_ params…) body) expressionReturns: STRING — Generated C source code
Examples:
(import x/tool/compile compile-to-c) (Str8 starts? "#include" (compile-to-c '(fn (_ x) (+ x 1)))) => #tcompile-writeWrite a string to a file. Returns the path.
Parameters:
STRING — Output file pathSTRING — Content to writeReturns: STRING — The path written to
compile-ccInvoke the C compiler on a source file to produce a shared library.
Parameters:
STRING — C source fileSTRING — Output shared library pathcompile-loadLoad a compiled shared library and return fn_0 as a callable primitive.
Parameters:
STRING — Path to shared libraryReturns: PRIMITIVE — Native function
compile-cc-flagsCompiler flags for the current platform.
Returns: LIST — Platform-specific cc flags
compile-extShared library file extension for the current platform.
Returns: STRING — .bundle or .so
compile-cCompile an (fn …) expression to a native primitive via C compiler. Caches by expression hash.
Parameters:
LIST — A (fn (_ params…) body) expressionReturns: PRIMITIVE — Compiled native function
compile-asmcompileCompile an (fn …) expression to native code. Pure expressions use JIT assembler; fvar expressions use C compiler with persistent caching.
Parameters:
LIST — A (fn (_ params…) body) expressionReturns: PRIMITIVE — Compiled native function