ohm
PEG.js
Our great sponsors
ohm | PEG.js | |
---|---|---|
10 | 8 | |
4,850 | 4,726 | |
1.3% | 1.0% | |
6.8 | 0.0 | |
12 days ago | over 2 years ago | |
JavaScript | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
ohm
-
Ohm: A library and language for building parsers, interpreters, compilers, etc.
Building an interpreter or a compiler from a grammar is an interesting idea. I can't immediately see how to go about it - the grammar would need to match on SSA or similar.
The examples have a lisp-like interpreter at https://github.com/ohmjs/ohm/blob/main/examples/simple-lisp/... which definitely uses a grammar for parsing and might use a generic AST representation.
Will have to think more - a grammar might be a worthwhile way to specify a nanopass style compiler pipeline.
-
[AskJS] Why does our community hate Operator Overloading?
One more suggestion: Maybe create your own scripting-language using Ohm? The project works in JavaScript, so whatever you created would sit on top of your existing APIs.
-
Ohm – A library and language for building parsers, interpreters, compilers, etc.
Always fun to find the first commit:
https://github.com/harc/ohm/commit/4611bf63c5ecb90d782112d68...
2014
Neat tool. I write parsers by hand though. More fun, and you can be a lot sleazier.
PEG.js
-
How do you start your own programming language?
Here's a javascript library that lets you generate your own language that compiles to Javascript. https://pegjs.org/ It's a compiler generator. You can either use the command line tool and feed it your grammar (You have to write that) and use the generated parser.js which can then run your program, or use peg.js as a dependency and generate your parser at run time before feeding it your program.
-
Deno in 2022
The library they're having trouble with is the most common parser generator in javascript, peg.js, which has about 80% of the market
What are some alternatives?
nearley - 📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
peggy - Peggy: Parser generator for JavaScript
Jison - Bison in JavaScript.
js-yaml - JavaScript YAML parser and dumper. Very fast.
Chevrotain - Parser Building Toolkit for JavaScript
markdown-it - Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed
csv-parser - Streaming csv parser inspired by binary-csv that aims to be faster than everyone else
parse-json - Parse JSON with more helpful errors
URI.js - Javascript URL mutation library
parse5 - HTML parsing/serialization toolset for Node.js. WHATWG HTML Living Standard (aka HTML5)-compliant.
marked - A markdown parser and compiler. Built for speed.
parsec 🌌 - 🌌 Tiniest body parser in the universe. Built for modern Node.js