Expand description
Bytecode compiler for Tish. Compiles AST to stack-based bytecode for VM execution.
Structs§
- Chunk
- A bytecode chunk: instructions and associated data.
- Compile
Error
Enums§
- Constant
- A constant in the constants table.
- Math
Binary Fn - The binary
Mathfunctions theOpcode::MathBinaryfast path recognizes (#203).(f64, f64) → f64; the discriminant is the opcode operand. Kept in sync with the VM handler and JIT lowering. (hypotis intentionally NOT here — it stays a correct generic call to avoid replicating its scaled-sum-of-squares in this below-builtins crate.) - Math
Unary Fn - The unary
Mathfunctions theOpcode::MathUnaryfast path recognizes (#186). f64→f64; the discriminant is the opcode operand. Kept in sync with the VM handler and the JIT lowering. - Opcode
- Stack-based bytecode opcodes.
Constants§
Functions§
- binop_
to_ u8 - Encode BinOp for bytecode operand. Used by compiler.
- compile
- Compile a Tish program to bytecode (with peephole optimizations).
- compile_
for_ repl - Compile for REPL: last expression statement leaves its value on the stack (no Pop, no trailing Null).
- compile_
for_ repl_ unoptimized - Compile for REPL without peephole optimizations.
- compile_
unoptimized - Compile without peephole optimizations (for –no-optimize).
- compile_
with_ source - Compile, tagging the chunk with a source file path so runtime errors can report
file:line(issue #74). The line table is built during compilation and survives the in-place peephole pass; it is not serialized. - compound_
op_ to_ u8 - Encode CompoundOp for bytecode (same numeric subset as BinOp: Add,Sub,Mul,Div,Mod).
- deserialize
- Deserialize a chunk from bytes.
- serialize
- Serialize a chunk to bytes (includes nested chunks for functions).
- u8_
to_ binop - Decode bytecode operand to BinOp. Used by VM.
- u8_
to_ unaryop - Decode bytecode operand to UnaryOp. Used by VM.
- unaryop_
to_ u8 - Encode UnaryOp for bytecode operand. Used by compiler.