30 releases (16 breaking)

0.17.2 Aug 21, 2019
0.17.1 Jun 24, 2019
0.17.0 May 7, 2019
0.16.3 Jan 20, 2019
0.2.0 Jul 27, 2015

#12 in Parser tooling

Download history 1845/week @ 2019-07-10 1992/week @ 2019-07-17 1895/week @ 2019-07-24 2100/week @ 2019-07-31 2484/week @ 2019-08-07 3181/week @ 2019-08-14 3059/week @ 2019-08-21 2925/week @ 2019-08-28 2586/week @ 2019-09-04 3607/week @ 2019-09-11 4628/week @ 2019-09-18 3935/week @ 2019-09-25 4039/week @ 2019-10-02 5719/week @ 2019-10-09 4925/week @ 2019-10-16

11,244 downloads per month
Used in 121 crates (53 directly)

Apache-2.0/MIT

2MB
54K SLoC

LALRPOP

Join the chat at https://gitter.im/lalrpop/Lobby

Build status

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:

  1. Nice error messages in case parser constructor fails.
  2. 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<Id> for a comma-separated list of identifiers.
  3. 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.
  4. Builtin support for operators like * and ?.
  5. Compact defaults so that you can avoid writing action code much of the time.
  6. 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.
  • The advanced setup chapter shows how to configure other aspects of LALRPOP's preprocessing.
  • 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.
  • Gleam is a statically typed functional programming language for the Erlang VM.
  • RustPython is Python 3.5+ rewritten in Rust

Contributing

You really should read CONTRIBUTING.md if you intend to change LALRPOP's own grammar.

Dependencies

~4.5MB
~107K SLoC