/// assemble takes an assembly target, and the assembly code an object that implements display
/// 
/// This function will 
/// 1. parse the assembly code and convert it into an abstract syntax tree
/// 2. convert the abstract syntax tree into a list of executable assembly instructions
/// 3. transform the list of assembly instructions into output code using the assembly target
assemble takes an assembly target, and the assembly code an object that implements display
This function will
1. parse the assembly code and convert it into an abstract syntax tree
2. convert the abstract syntax tree into a list of executable assembly instructions
3. transform the list of assembly instructions into output code using the assembly target
assemble takes an assembly target and the assembly code an object that implements display This function will 1 . parse the assembly code and convert it into an abstract syntax tree 2 . convert the abstract syntax tree into a list of executable assembly instructions 3 . transform the list of assembly instructions into output code using the assembly target
pub fn assemble(target: impl Target, asm_code: impl core::fmt::Display) -> Result<String> {
    use asm::{REGISTER_POINTER, NAMED_REGISTERS, PREDEFINED_REGISTERS};
    let (code, stack_size) = compile(asm_code)?;
    let initial_stack_ptr = *REGISTER_POINTER.lock();
    // Reset the global variables used for assembling an input file
    *REGISTER_POINTER.lock() = PREDEFINED_REGISTERS;
    *NAMED_REGISTERS.lock() = BTreeMap::new();
    // Assemble using the targets assembly method
    Ok(target.assemble(initial_stack_ptr, stack_size, code))
}
pub fn assemble ( target : impl Target , asm_code : impl core :: fmt :: Display ) -> Result < String > { use asm :: { REGISTER_POINTER , NAMED_REGISTERS , PREDEFINED_REGISTERS } ; let ( code , stack_size ) = compile ( asm_code ) ? ; let initial_stack_ptr = * REGISTER_POINTER . lock ( ) ; // Reset the global variables used for assembling an input file * REGISTER_POINTER . lock ( ) = PREDEFINED_REGISTERS ; * NAMED_REGISTERS . lock ( ) = BTreeMap :: new ( ) ; // Assemble using the targets assembly method Ok ( target . assemble ( initial_stack_ptr , stack_size , code ) ) }
assemble takes an assembly target, and the assembly code an object that implements display
This function will
1. parse the assembly code and convert it into an abstract syntax tree
2. convert the abstract syntax tree into a list of executable assembly instructions
3. transform the list of assembly instructions into output code using the assembly target
assemble takes an assembly target and the assembly code an object that implements display This function will 1 . parse the assembly code and convert it into an abstract syntax tree 2 . convert the abstract syntax tree into a list of executable assembly instructions 3 . transform the list of assembly instructions into output code using the assembly target
target
impl Target
asm_code
impl core::fmt::Display