add pretty-printer for assembled instructions

This commit is contained in:
2020-10-05 00:32:08 +02:00
parent 986f3be6a2
commit 34e339b1ca
11 changed files with 247 additions and 12 deletions
+11 -1
View File
@@ -7,6 +7,9 @@ use crsn::runtime::fault::Fault;
use crsn::runtime::run_thread::{state::RunState, ThreadInfo};
use crate::defs::StackOp;
use crsn::sexp::Sexp;
use crsn::sexp;
use crsn::utils::A;
#[derive(Debug, Default)]
struct Stacks {
@@ -64,7 +67,14 @@ impl OpTrait for StackOp {
Ok(eres)
}
//
fn to_sexp(&self) -> Sexp {
match self {
StackOp::NewStack { dst } => sexp::list(&[A("stack"), A(dst)]),
StackOp::Push { obj, src } => sexp::list(&[A("push"), A(obj), A(src)]),
StackOp::Pop { dst, obj } => sexp::list(&[A("pop"), A(dst), A(obj)]),
}
}
}
pub(crate) fn drop_obj(state: &mut RunState, handle: Value) -> Result<Option<()>, Fault> {