Croissant Runtime
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
crsn/crsn_stacks/src/lib.rs

34 lines
834 B

use crsn::module::{CrsnExtension, ParseOpRes};
use crsn::asm::parse::arg_parser::ArgParser;
use crsn::asm::instr::Op;
use crsn::asm::error::CrsnError;
use crsn::runtime::run_thread::{ThreadInfo, RunState};
use crsn::asm::data::literal::Value;
use crsn::runtime::fault::Fault;
mod defs;
mod parse;
mod exec;
#[derive(Debug, Clone)]
pub struct StackOps;
impl StackOps {
pub fn new() -> Box<dyn CrsnExtension> {
Box::new(Self)
}
}
impl CrsnExtension for StackOps {
fn name(&self) -> &'static str {
"stacks"
}
fn parse_op(&self, keyword: &str, args: ArgParser) -> Result<ParseOpRes<Op>, CrsnError> {
parse::parse(keyword, args)
}
fn drop_obj(&self, ti: &ThreadInfo, state: &mut RunState, handle: Value) -> Result<Option<()>, Fault> {
exec::drop_obj(state, handle)
}
}