feat(tazjin/rlox): Support trivial literals in bytecode compiler
Adds support for true, false & nil. These each come with a new separate opcode and are pushed directly on the stack. Change-Id: I405b5b09496dcf99d514d3411c083e0834377167 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2571 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
This commit is contained in:
parent
127ef98486
commit
47ffa80711
5 changed files with 52 additions and 6 deletions
|
|
@ -1,8 +1,13 @@
|
|||
#[derive(Debug)]
|
||||
pub enum OpCode {
|
||||
/// Access a constant for use.
|
||||
/// Push a constant onto the stack.
|
||||
OpConstant(usize),
|
||||
|
||||
// Literal pushes
|
||||
OpNil,
|
||||
OpTrue,
|
||||
OpFalse,
|
||||
|
||||
/// Return from the current function.
|
||||
OpReturn,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue