pub fn compile(
    source: &str,
    mode: Mode,
    source_path: String,
    optimize: u8,
) -> Result<CodeObject, CompileError> {
    match mode {
        Mode::Exec => {
            let ast = parser::parse_program(source)?;
            compile_program(ast, source_path, optimize)
        }
        Mode::Eval => {
            let statement = parser::parse_statement(source)?;
            compile_statement_eval(statement, source_path, optimize)
        }
        Mode::Single => {
            let ast = parser::parse_program(source)?;
            compile_program_single(ast, source_path, optimize)
        }
    }
}
/// Compile a given sourcecode into a bytecode object.
Compile a given sourcecode into a bytecode object.
Compile a given sourcecode into a bytecode object .
pub fn compile(
    source: &str,
    mode: Mode,
    source_path: String,
    optimize: u8,
) -> Result<CodeObject, CompileError> {
    match mode {
        Mode::Exec => {
            let ast = parser::parse_program(source)?;
            compile_program(ast, source_path, optimize)
        }
        Mode::Eval => {
            let statement = parser::parse_statement(source)?;
            compile_statement_eval(statement, source_path, optimize)
        }
        Mode::Single => {
            let ast = parser::parse_program(source)?;
            compile_program_single(ast, source_path, optimize)
        }
    }
}
pub fn compile ( source : & str , mode : Mode , source_path : String , optimize : u8 , ) -> Result < CodeObject , CompileError > { match mode { Mode :: Exec => { let ast = parser :: parse_program ( source ) ? ; compile_program ( ast , source_path , optimize ) } Mode :: Eval => { let statement = parser :: parse_statement ( source ) ? ; compile_statement_eval ( statement , source_path , optimize ) } Mode :: Single => { let ast = parser :: parse_program ( source ) ? ; compile_program_single ( ast , source_path , optimize ) } } }
Compile a given sourcecode into a bytecode object.
Compile a given sourcecode into a bytecode object .
source
&str
mode
Mode
source_path
String
optimize
u8