diff --git a/src/runtime.rs b/src/runtime.rs index 34cb9b2..4409b42 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -14,6 +14,7 @@ pub struct Function { pub struct Runtime { pub registry: Registry, pub functions: HashMap, + pub opcodes: HashMap)>>, } impl Registry { @@ -27,6 +28,7 @@ impl Runtime { Self { registry: Registry::new(), functions: HashMap::new(), + opcodes: HashMap::new(), } } } @@ -53,7 +55,12 @@ impl Runtime { for statement in statements { match statement { Statement::Instruction(inst) => { - println!("{inst:#?}"); + let op = self + .opcodes + .get(&inst.opcode.to_lowercase()) + .expect("Invalid opcode"); + + (op)(vec![]); } _ => {} }