#javascript #compiler #lexer #parser #js

Boa

Boa is a Javascript lexer, parser and Just-in-Time compiler written in Rust. Currently, it has support for some of the language.

18 releases (7 breaking)

✓ Uses Rust 2018 edition

new 0.8.0 May 23, 2020
0.6.0 Feb 14, 2020
0.5.1 Dec 2, 2019
0.5.0 Nov 6, 2019
0.1.5 Nov 28, 2018

#37 in Parser implementations

Download history 18/week @ 2020-01-23 9/week @ 2020-01-30 21/week @ 2020-02-06 35/week @ 2020-02-13 305/week @ 2020-02-20 26/week @ 2020-02-27 137/week @ 2020-03-05 18/week @ 2020-03-12 74/week @ 2020-03-19 56/week @ 2020-03-26 13/week @ 2020-04-02 87/week @ 2020-04-09 76/week @ 2020-04-16 24/week @ 2020-04-23 12/week @ 2020-04-30 7/week @ 2020-05-07

189 downloads per month
Used in dot-http

Unlicense/MIT and MPL-2.0 licenses

1MB
17K SLoC

Boa

logo

This is an experimental Javascript lexer, parser and compiler written in Rust. Currently, it has support for some of the language.

Build Status

Live Demo (WASM)

https://jasonwilliams.github.io/boa/

You can get more verbose errors when running from the command line

Development documentation

You can check the internal development docs at https://jasonwilliams.github.io/boa/doc

Benchmarks

https://jasonwilliams.github.io/boa/dev/bench/

Contributing

Please, check the CONTRIBUTING.md file to know how to contribute in the project. You will need Rust installed and an editor. We have some configurations ready for VSCode.

Debugging

See Debugging.

Web Assembly

This interpreter can be exposed to javascript! You can build the example locally with:

$ yarn install
$ yarn serve

In the console you can use window.evaluate to pass JavaScript in To develop on the web assembly side you can run yarn serve then go to http://localhost:8080

Roadmap

See Milestones

Changelog

see CHANGELOG

Usage

  • Clone this repo
  • Run with cargo run -- test.js where test.js is an existing JS file
  • If any JS doesn't work then it's a bug. Please raise an issue!

Command-line Options

USAGE:
    boa_cli [OPTIONS] [FILE]...

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -a, --dump-ast <FORMAT>       Dump the ast to stdout with the given format [possible values: Debug, Json,
                                  JsonPretty]
    -t, --dump-tokens <FORMAT>    Dump the token stream to stdout with the given format [possible values: Debug, Json,
                                  JsonPretty]

ARGS:
    <FILE>...    The JavaScript file(s) to be evaluated

Communication

Feel free to contact us on Discord https://discord.gg/tUFFk9Y

Example

Example

License

This project is licensed under the Unlicense or MIT licenses, at your option.

Dependencies

~2.7–3.5MB
~89K SLoC