Boa: an experimental Javascript lexer, parser and compiler written in Rust
boa-dev.github.io
boa-dev.github.io
For another JavaScript parser, but written in TypeScript, check out Seafox [2]. It's also self-hosted [3], which I always enjoy seeing.
[1] https://boa-dev.github.io/boa/dev/bench/
"QuickJS is a small and embeddable Javascript engine. It supports the ES2020 specification including modules, asynchronous generators, proxies and BigInt."
I understand that it's important to eat your own dog food, in order to experience the pain points yourself. But sometimes people think of self hosting as a symbol of something (pride maybe), and that's the wrong way to approach a programming problem in my opinion.
But if you want to keep the code simpler, a higher-level language could potentially give better performance, simply because it's easier to share data structures, avoid copying, etc. Additionally, things like immutable persistent maps are a great fit for environments in a compiler, and they are much easier to implement in a language with garbage collection.
That said, obviously some high-level languages are still going to be too slow without also putting in a lot of work. I think there's a sweet spot with languages that compile to reasonably fast machine code but are also garbage collected. Languages like OCaml, Go, Haskell. Though I personally wouldn't use Go, but that's for reasons other than performance.
But Boa the web server was discontinued in 2005 so i guess it's fair to reuse the name.
-----
I'm curious to understand the use cases they're trying to solve for. I recognize this is experimental, but it's hard to visualize what this is supposed to be for.
2. The way I see it, re-implementing JS from scratch in a language that is designed to help avoid very common, often compromising programming mistakes around concurrency and memory management makes perfect sense. Eventually this might make it into browsers and web servers; environments that are executing untrusted code in the former case and are publicly exposed in the latter case. Having them be fast-yet-secure is important, isn't it?
Of course, it's early days, but you gotta start somewhere after all...
I'm skeptical at least for browsers. Browser JS VMs have integration between their parsers and their interpreter and their JITs, at minimum. You wouldn't really be able to drop in a standalone project like this.
But I agree it's not a bad thing to have more JS parsers out there!
Many are already written in a safe language, though, so this isn't new, for example several are written in JS and TS, there is Rhino in Java, Otto in Go, Esprima .NET in C#, etc. etc. But it's natural to want one in Rust as well.
All of those have a mandatory GC.
As I said, it's natural to want a JS parser in Rust. Each language has its own benefits, and Rust's are quite unique.
Rather than curse the darkness, I'll quote the first sentence from the page: "Boa is an experimental Javascript lexer, parser and compiler written in Rust." What's so great about this particular release? "v0.10 has been the biggest release to date, with 138 issues closed!" Also, there's a test suite: 38,706 tests, of which 6,895 passed and 5,748 were ignored, for a conformance rate of 17.81%.
@dang could you change it to "Boa release v0.10" ?