by eatonphil · 4y ago · 0 comments
Instruction::Add => {
let left = data.pop().unwrap();
top = left + top;
pc += 1;
}
Instruction::Subtract => {
let left = data.pop().unwrap();
top = left - top;
pc += 1;
}
Instruction::LessThan => {
let left = data.pop().unwrap();
top = if left < top { 1 } else { 0 });
pc += 1;
}My actual long-term goal is to build a VM in Rust and then use this to re-do the Make A Lisp project [0]. I completed this a couple of years ago using C# but felt vaguely uneasy that I was using C# to do the heavy lifting associated with garbage collection, etc.