Skip to main content

Crate tishlang_bytecode

Crate tishlang_bytecode 

Source
Expand description

Bytecode compiler for Tish. Compiles AST to stack-based bytecode for VM execution.

Structs§

Chunk
A bytecode chunk: instructions and associated data.
CompileError

Enums§

Constant
A constant in the constants table.
Opcode
Stack-based bytecode opcodes.

Constants§

NO_REST_PARAM

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).
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.