1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-10-16 02:37:40 -05:00

refactor: move file up 1 director

This commit is contained in:
Natapat Samutpong 2022-01-26 09:21:53 +07:00
parent c3491e3508
commit 17981acc49
16 changed files with 9 additions and 5 deletions

View file

View file

1
blspc/example/if.blsp Normal file
View file

@ -0,0 +1 @@
(if true (print "True") (print "False"))

View file

@ -35,14 +35,16 @@ pub enum Instr {
// Load a literal value onto the stack. // Load a literal value onto the stack.
Load { address: Register }, Load { address: Register },
// Store a literal value into a register. // Store a literal value into a register.
Store { address: Register, value: Type, }, Store { address: Register, value: Type },
// Call intrinsic function. // Call intrinsic function.
Call { address: Register, args: Register }, Call { address: Register, args: Register },
// Immediate arithmetic. // Immediate arithmetic.
IAdd { lhs: Register, rhs: Register, to: Register, }, IAdd { lhs: Register, rhs: Register, to: Register },
ISub { lhs: Register, rhs: Register, to: Register, }, ISub { lhs: Register, rhs: Register, to: Register },
IMul { lhs: Register, rhs: Register, to: Register, }, IMul { lhs: Register, rhs: Register, to: Register },
IDiv { lhs: Register, rhs: Register, to: Register, }, IDiv { lhs: Register, rhs: Register, to: Register },
// Jumping
JumpIfFalse { cond: Register, to: Register },
} }
impl Display for Instr { impl Display for Instr {
@ -55,6 +57,7 @@ impl Display for Instr {
Instr::ISub { lhs, rhs, to } => write!(f, "ISUB {} {} {}", lhs, rhs, to), Instr::ISub { lhs, rhs, to } => write!(f, "ISUB {} {} {}", lhs, rhs, to),
Instr::IMul { lhs, rhs, to } => write!(f, "IMUL {} {} {}", lhs, rhs, to), Instr::IMul { lhs, rhs, to } => write!(f, "IMUL {} {} {}", lhs, rhs, to),
Instr::IDiv { lhs, rhs, to } => write!(f, "IDIV {} {} {}", lhs, rhs, to), Instr::IDiv { lhs, rhs, to } => write!(f, "IDIV {} {} {}", lhs, rhs, to),
Instr::JumpIfFalse { cond, to } => write!(f, "JUMP_IF_FALSE {} {}", cond, to),
} }
} }
} }