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/src/asm/mod.rs

23 lines
626 B

use std::sync::Arc;
use crate::module::CrsnExtension;
use crate::runtime::program::Program;
pub mod data;
pub mod error;
pub mod instr;
pub mod parse;
pub mod patches;
/// Parse a program from string and assemble a low level instruction sequence from it.
pub fn assemble(source: &str, parsers: Arc<Vec<Box<dyn CrsnExtension>>>) -> Result<Arc<Program>, error::Error> {
let ops = parse::parse(source, &parsers)?;
trace!("--- Compiled program ---");
for (n, op) in ops.iter().enumerate() {
trace!("{:04} : {:?}", n, op);
}
trace!("------------------------");
Ok(Program::new(ops, parsers))
}