xassembler 0.5.1

Compiler tools for the xasm programming language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::{parser::parse, Compile, Target};

use alloc::string::String;

pub fn compile<T: Target>(script: &str) -> Result<String, String> {
    match parse(script) {
        Ok(ast) => match Compile::<T>::compile(ast) {
            Ok(code_gen) => Ok(code_gen.replace(";", ";\n\t")),
            Err(e) => Err(format!("{:?}", e)),
        },
        Err(e) => Err(format!("{}", e)),
    }
}