An extension to Lark that generates a Javascript standalone
Project description
Lark.js - a port of the Lark parsing toolkit to Javascript
Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
With Lark.js, you create a fast Javascript parser from a grammar written for Lark.
The compiled Javascript modules include Lark's base classes and utilities, such as Tree
, Transformer
, and InteractiveParser
.
Currently, only LALR(1) is supported. (Earley support is planned!)
Quick links
Install Lark.js
$ pip install lark-js --upgrade
Generate a Javascript LALR(1) parser
python -m lark-js my_grammar.lark -o my_parser.js
For help, run:
python -m lark-js --help
Syntax Highlighting
Lark provides syntax highlighting for its grammar files (*.lark):
List of main features
- Builds a parse-tree (AST) automagically, based on the structure of the grammar
- LALR(1) parser - Fast and light
- EBNF grammar
- Usable in the browser and in Node
- Automatic line & column tracking
- Standard library of terminals (strings, numbers, names, etc.)
- Import grammars from Nearley.js (read more)
- And much more!
License
Lark.js uses the MIT license.
Contribute
Lark.js is accepting pull-requests. If you would like to help, open an issue or find us on gitter.
Sponsoring
Lark.js was made possible with the help of a generous donation by Smore ❤️
If you like Lark, and want to see it grow, please consider sponsoring us!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Lark_js-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c916016a445edf5ebc6564ee089bcbdcb15e8cb44c9095bf1decd80d4dfef8f0 |
|
MD5 | 729023495d8200fffaa869fd578d9926 |
|
BLAKE2b-256 | fdb8c8e303ae8766e5827560f2bbe929ef7cbb9bf6096647bc7709a81a4b5058 |