This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a very minimal instruction set. | |
// it has just enough operations to implement a recursive | |
// fibonacci function - what a coincidence :D | |
// NOTE: in my VM, i don't use an `enum`. | |
// this is just for simplicity. | |
#[derive(Clone, Copy, Debug)] | |
enum Instruction { | |
LoadInt { dst: u8, value: i16 }, | |
Copy { dst: u8, src: u8 }, | |
Add { dst: u8, src1: u8, src2: u8 }, |