pub struct Compiler { /* private fields */ }Expand description
Bytecode compiler state
Implementations§
Source§impl Compiler
impl Compiler
Sourcepub fn compile(expr: &Expr) -> CompileResult<Chunk>
pub fn compile(expr: &Expr) -> CompileResult<Chunk>
Main entry point: compile an expression to a chunk (backward compatible)
Sourcepub fn compile_checked(expr: &Expr) -> CompileResult<Chunk>
pub fn compile_checked(expr: &Expr) -> CompileResult<Chunk>
Compile an expression with type checking enabled
Sourcepub fn compile_with_options(
expr: &Expr,
options: CompileOptions,
) -> CompileResult<Chunk>
pub fn compile_with_options( expr: &Expr, options: CompileOptions, ) -> CompileResult<Chunk>
Compile an expression with custom options
Sourcepub fn compile_program(program: &Program) -> CompileResult<Chunk>
pub fn compile_program(program: &Program) -> CompileResult<Chunk>
Compile a complete program with modules
This is the main entry point for compiling programs with module definitions. It performs three phases:
- Register all modules and their bindings
- Apply imports to the current environment
- Compile the main expression (if present)