From 13a9c59364a459b5277703cb7a847c500a81f50e Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Sat, 14 Mar 2026 00:09:53 +0100 Subject: [PATCH] Opcode calling --- src/runtime.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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![]); } _ => {} }