26 releases (15 breaking)

Uses old Rust 2015

0.16.0 Sep 3, 2018
0.15.2 May 3, 2018
0.15.1 Apr 5, 2018
0.15.0 Mar 22, 2018
0.2.0 Jul 27, 2015

#175 in Parser tooling

Download history 308/week @ 2024-07-22 297/week @ 2024-07-29 272/week @ 2024-08-05 382/week @ 2024-08-12 233/week @ 2024-08-19 228/week @ 2024-08-26 192/week @ 2024-09-02 206/week @ 2024-09-09 136/week @ 2024-09-16 318/week @ 2024-09-23 186/week @ 2024-09-30 16/week @ 2024-10-07 217/week @ 2024-10-14 182/week @ 2024-10-21 198/week @ 2024-10-28 247/week @ 2024-11-04

844 downloads per month

Apache-2.0/MIT

4.5MB
102K 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.

Example Uses

  • LALRPOP is itself implemented in LALRPOP.
  • Gluon is a statically typed functional programming language.

Dependencies

~7MB
~120K SLoC