Skip to main content

Crate candela

Crate candela 

Source
Expand description

candela is the full toolchain: lexer, parser, type-checker, compiler, REPL, the Engine/Program embedding API, and the candela build subcommand.

The runtime core (the VM executor, bytecode/data types, GC, value marshalling, and the .cdlb load/run API) lives in the self-contained candela-vm crate. This crate depends on it (strictly candela -> candela-vm) and aliases its modules under crate:: so the compiler keeps its crate::data / crate::instr / crate::rt / crate::errors / crate::vm paths.

Re-exports§

pub use cfg::Cfg;
pub use compiler::imports::ImportResolver;
pub use compiler::compiler_data::TypeNames;

Modules§

cfg
Compile-time configuration: the names @cfg(...) tests.
compiler
macros
Macros: source regions an embedder expands.
parser

Structs§

BuildOptions
How a program is built into an artifact.
Diagnostic
A structured compile/runtime error, produced instead of printing + exiting whenever a diagnostic sink is installed (see collect_diagnostic).
Engine
The persistent embedding entry point. Holds the table of registered host functions and compiles scripts into reusable Programs.
GcStats
What the collector has done over a set of pools, and how large they are.
HostError
Why a registered host function failed.
HostRegistry
The table of Rust closures a script’s host blocks bind to.
PoolStats
How large one pool is.
Program
A compiled candela program with resident interpreter state.
RuntimeProgram
A loaded, ready-to-run program image with owned runtime state.

Enums§

CallError
Why a RuntimeProgram::call did not produce a value.
HostBindError
Why a script’s host blocks could not be bound to a HostRegistry.
HostType
The type kinds that can cross the host boundary.
LoadError
Why a .cdlb artifact could not be loaded.
NativeCode
Which machine code a release build puts in the artifact.
Value
A dynamically-typed value passed across the host/script boundary.

Traits§

FromHostValue
Extracts a Rust argument from a Value for a registered host closure.
IntoHostFn
Adapts a Rust closure into a registered host function.
IntoHostResult
What a registered host closure returns: a value, or an error to raise in the script that called it.
IntoHostValue
Converts a host closure’s return value into a Value.

Functions§

build_artifact
Compiles a .cdl source string to a .cdlb artifact the way options asks. build_bytecode is this with the defaults candela build uses.
build_bytecode
Compiles a .cdl source string to a .cdlb bytecode artifact.
check_only
compile_checked as a check only, which opens no library.
collect_diagnostic
Runs f with a diagnostic sink installed.
collect_warnings
Runs f and returns what it produced together with every warning raised while it ran, in the order they were raised. Nothing is printed.
compile_checked
Compiles source the way candela build does: the whole program, and then an entry point for every fully annotated function in it.
dylib_dirs
The directories set_dylib_dirs put in effect on this thread.
load_program
Loads a .cdlb bytecode artifact into a runnable RuntimeProgram.
main
The candela command. The command line itself is read in [cli].
set_dylib_dirs
Sets the directories a dylib import’s library is looked for in on this thread, and returns the ones that were in effect, so a caller can put them back.