[fine] While loops, nothing
This commit is contained in:
parent
1cc5ce6ca9
commit
ac3c158a81
7 changed files with 166 additions and 48 deletions
|
|
@ -430,21 +430,41 @@ fn eval_one(
|
|||
|
||||
f.push_string(new_string.into());
|
||||
}
|
||||
Instruction::CompareBool => {
|
||||
Instruction::EqBool => {
|
||||
let x = f.pop_bool()?;
|
||||
let y = f.pop_bool()?;
|
||||
f.push_bool(x == y);
|
||||
}
|
||||
Instruction::CompareFloat => {
|
||||
Instruction::EqFloat => {
|
||||
let x = f.pop_float()?;
|
||||
let y = f.pop_float()?;
|
||||
f.push_bool(x == y);
|
||||
}
|
||||
Instruction::CompareString => {
|
||||
Instruction::EqString => {
|
||||
let x = f.pop_string()?;
|
||||
let y = f.pop_string()?;
|
||||
f.push_bool(x == y);
|
||||
}
|
||||
Instruction::GreaterFloat => {
|
||||
let x = f.pop_float()?;
|
||||
let y = f.pop_float()?;
|
||||
f.push_bool(y > x);
|
||||
}
|
||||
Instruction::GreaterString => {
|
||||
let x = f.pop_string()?;
|
||||
let y = f.pop_string()?;
|
||||
f.push_bool(y > x);
|
||||
}
|
||||
Instruction::LessFloat => {
|
||||
let x = f.pop_float()?;
|
||||
let y = f.pop_float()?;
|
||||
f.push_bool(y < x);
|
||||
}
|
||||
Instruction::LessString => {
|
||||
let x = f.pop_string()?;
|
||||
let y = f.pop_string()?;
|
||||
f.push_bool(y < x);
|
||||
}
|
||||
|
||||
Instruction::NewObject(slots) => {
|
||||
let class_id = f.pop_int()?;
|
||||
|
|
@ -496,16 +516,16 @@ pub fn eval(
|
|||
let instructions = f.func.instructions();
|
||||
let instruction = instructions[index];
|
||||
|
||||
{
|
||||
eprint!("{index}: {instruction:?} [");
|
||||
for val in f.stack.iter().rev().take(3) {
|
||||
eprint!("{val:?} ");
|
||||
}
|
||||
if f.stack.len() > 3 {
|
||||
eprint!("...");
|
||||
}
|
||||
eprintln!("]");
|
||||
}
|
||||
// {
|
||||
// eprint!("{index}: {instruction:?} [");
|
||||
// for val in f.stack.iter().rev().take(3) {
|
||||
// eprint!("{val:?} ");
|
||||
// }
|
||||
// if f.stack.len() > 3 {
|
||||
// eprint!("...");
|
||||
// }
|
||||
// eprintln!("]");
|
||||
// }
|
||||
|
||||
index += 1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue