Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lalrpop/lalrpop
LR(1) parser generator for Rust
https://github.com/lalrpop/lalrpop
grammar parser-generator rust
Last synced: 6 days ago
JSON representation
LR(1) parser generator for Rust
- Host: GitHub
- URL: https://github.com/lalrpop/lalrpop
- Owner: lalrpop
- License: apache-2.0
- Created: 2015-06-12T19:41:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-10-18T12:41:04.000Z (16 days ago)
- Last Synced: 2024-10-20T08:45:33.011Z (15 days ago)
- Topics: grammar, parser-generator, rust
- Language: Rust
- Homepage: http://lalrpop.github.io/lalrpop/
- Size: 9.48 MB
- Stars: 3,037
- Watchers: 34
- Forks: 290
- Open Issues: 149
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-rust-cn - lalrpop/lalrpop - ci.org/lalrpop/lalrpop.svg?branch=master)](https://travis-ci.org/lalrpop/lalrpop) (Libraries / Parsing)
- awesome-rust - lalrpop/lalrpop - ci.org/lalrpop/lalrpop.svg?branch=master)](https://travis-ci.org/lalrpop/lalrpop) (Libraries / Parsing)
- awesome-rust - lalrpop/lalrpop
- awesome-rust-cn - lalrpop/lalrpop
- awesome-list - lalrpop
- awesome-rust-zh - lalrpop/lalrpop - LR(1)螃蟹解析器生成[![Build status](https://api.travis-ci.org/lalrpop/lalrpop.svg?branch=master)](https://travis-ci.org/lalrpop/lalrpop) (库 / 解析)
- awesome-starred - lalrpop/lalrpop - LR(1) parser generator for Rust (rust)
README
# LALRPOP
[![Join the chat at https://gitter.im/lalrpop/Lobby](https://badges.gitter.im/lalrpop/Lobby.svg)](https://gitter.im/lalrpop/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Deploy](https://github.com/lalrpop/lalrpop/actions/workflows/deploy.yml/badge.svg)](https://github.com/lalrpop/lalrpop/actions/workflows/deploy.yml)
LALRPOP is a Rust parser generator framework with *usability* as its
primary goal. You should be able to write compact, DRY, readable
grammars. To this end, LALRPOP offers a number of nifty features:0. Nice error messages in case parser constructor fails.
1. Macros that let you extract common parts of your grammar. This
means you can go beyond simple repetition like `Id*` and define
things like `Comma` for a comma-separated list of identifiers.
2. Macros can also create subsets, so that you easily do something
like `Expr<"all">` to represent the full range of expressions, but
`Expr<"if">` to represent the subset of expressions that can appear
in an `if` expression.
3. Builtin support for operators like `*` and `?`.
4. Compact defaults so that you can avoid writing action code much of the
time.
5. Type inference so you can often omit the types of nonterminals.Despite its name, LALRPOP in fact uses LR(1) by default (though you
can opt for LALR(1)), and really I hope to eventually move to
something general that can handle all CFGs (like GLL, GLR, LL(\*),
etc).### Documentation
[The LALRPOP book] covers all things LALRPOP -- or at least it intends
to! Here are some tips:- The [tutorial] covers the basics of setting up a LALRPOP parser.
- For the impatient, you may prefer the [quick start guide] section, which describes
how to add LALRPOP to your `Cargo.toml`.
- Returning users of LALRPOP may benefit from the [cheat sheet].
- The [advanced setup] chapter shows how to configure other aspects of LALRPOP's
preprocessing.
- docs.rs API documentation for [lalrpop](https://docs.rs/lalrpop/latest/lalrpop/) and [lalrpop-util]
- If you have any questions join our [gitter lobby].### Example Uses
- [LALRPOP] is itself implemented in LALRPOP.
- [Gluon] is a statically typed functional programming language.
- [RustPython] is Python 3.5+ rewritten in Rust
- [Solang] is Ethereum Solidity rewritten in Rust[The LALRPOP book]: https://lalrpop.github.io/lalrpop/
[quick start guide]: https://lalrpop.github.io/lalrpop/quick_start_guide.html
[advanced setup]: https://lalrpop.github.io/lalrpop/advanced_setup.html
[cheat sheet]: https://lalrpop.github.io/lalrpop/cheatsheet.html
[tutorial]: https://lalrpop.github.io/lalrpop/tutorial/index.html
[LALRPOP]: https://github.com/lalrpop/lalrpop/blob/master/lalrpop/src/parser/lrgrammar.lalrpop
[Gluon]: https://github.com/gluon-lang/gluon/blob/master/parser/src/grammar.lalrpop
[RustPython]: https://github.com/RustPython/Parser/blob/main/parser/src/python.lalrpop
[Solang]: https://github.com/hyperledger/solang/blob/main/solang-parser/src/solidity.lalrpop
[gitter lobby]: https://gitter.im/lalrpop/Lobby
[lalrpop-util]: https://docs.rs/lalrpop-util/latest/lalrpop_util/### Contributing
You **really** should read `CONTRIBUTING.md` if you intend to change LALRPOP's own grammar.