Skip to main content

compile

Function compile 

Source
pub fn compile(program: &ProgramData) -> Chunk
Expand description

Compile an AST program into stack-based bytecode.

Transforms the AST into a linear sequence of bytecode instructions for execution by the stack-based VM.

ยงExamples

use just::parser::JsParser;
use just::runner::jit;

let code = "var x = 5 + 3;";
let ast = JsParser::parse_to_ast_from_str(code).unwrap();
let chunk = jit::compile(&ast);