quickjs-compile 0.6.1

Bytecode compiler for the pure-Rust QuickJS port
Documentation
1
2
3
4
5
6
7
8
9
10
//! The example in README.md, kept compilable so the two cannot drift.
use js_compile::{compile_script, disassemble};
use js_parse::parse_script;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let program = parse_script("var x = 1; x + 2;")?;
    let function = compile_script(&program)?;
    print!("{}", disassemble(&function));
    Ok(())
}