diff --git a/src/main.rs b/src/main.rs index c44c6ae..9185e15 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,9 @@ use crate::vm::frame::{Frame, UserFrame}; struct Opt { #[structopt(name = "PATH", parse(from_os_str))] path: Option, + + #[structopt(long)] + disassemble: bool, } type Result> = std::result::Result; @@ -72,8 +75,11 @@ fn main() -> Result { exec_body.push(Inst::Push(ObjPtr::new(Int::new(0)))); exec_body.push(Inst::Return); - //disassemble(&exec_body); - //return Ok(()); + // Disassemble + if opt.disassemble { + disassemble(&exec_body); + return Ok(()); + } let locals: Vec<_> = scope.keys().copied().collect(); let main_fun: ObjPtr<_> = UserFun::new(None, vec![], locals, exec_body).into();