Crate ezjs

Source
Expand description

§ezjs

A light Javascript (ES5 version) runtime library , you can use Javascript as DSL in your project. Whole design is inspired from https://mujs.com/, including including a simple bytecode virtual machine. You can added a extenstion hook type via Rust’s generic features, and this hook type play key role in your DSL enviroment.

All implementation including tokenlizer, AST builder, compiler, optimizer(TODO), and VM executer is simple and easy to debug, so I called this library ezjs.

An completed example is a repl ( src/bin/repl.rs), which including a hookable extention struct.

Modules§

runtime
value

Functions§

build_function_from_code
The function compile string to bytecode of Virtual Machone. If some erros happens, return it with errpr message in a Resut.
dump_function
Print all bytecode of Function object, whith internal data.
new_runtime
Create an new JsRuntime struct of ezjs, which execute byte of VMFunction. All internal members are open and defined in runtime.rs.
run_script
Run bytecode of VMFunction with a runtime, and return the result sharedvalue. See more info via repl example.