added comparison operators

This commit is contained in:
Goren Barak 2023-12-31 14:38:50 -05:00
parent bfc8d86b54
commit 703f395998
3 changed files with 14 additions and 5 deletions

View file

@ -75,6 +75,20 @@ impl<'a> Vm {
} else {
self.stack.push(0)
}
},
"<" => {
if unwrap!() > unwrap!() {
self.stack.push(1);
} else {
self.stack.push(0);
}
},
">" => {
if unwrap!() < unwrap!() {
self.stack.push(1);
} else {
self.stack.push(0);
}
}
"MOD"|"mod" => {
let stack_top = unwrap!();

View file

@ -1,4 +0,0 @@
variable loopy
BEGIN 12 1 loopy +! WHILE 10 loopy @ <> REPEAT
trace stack

View file

@ -1 +0,0 @@
BEGIN 12 1 UNTIL