Skip to content
LR(1) parser generator for Rust
Branch: master
Clone or download
nwtnni and Marwes Split apart UnrecognizedEOF error variant from UnrecognizedToken (#446)
* Split apart UnrecognizedEOF error variant from UnrecognizedToken

* Factor out fmt_expected function

* Initial attempt at fixing codegen

- Match on lookahead when returning error
- Use last fixed symbol as location of UnrecognizedEOF
- Use `Default::default()` when there are no fixed symbols (?)

* Initial implementation of finding latest optional location

* Fix UnrecognizedToken errors in `Some` test cases

* Fix UnrecognizedEOF test cases

* Fix parentheses around pattern error for 1.26 compatibility

* Add basic test for UnrecognizedEOF (and hopefully trigger Travis build)

* Fix emitted indentation and use travis_wait when testing
Latest commit 4643478 Mar 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc type type -> type Mar 5, 2019
lalrpop-test Split apart UnrecognizedEOF error variant from UnrecognizedToken (#446) Mar 25, 2019
lalrpop-util Split apart UnrecognizedEOF error variant from UnrecognizedToken (#446) Mar 25, 2019
lalrpop Split apart UnrecognizedEOF error variant from UnrecognizedToken (#446) Mar 25, 2019
tools upgrade version of mdbook to match what I have locally =) Feb 4, 2018
.clog.toml Update RELEASES.md with clog Oct 27, 2018
.gitattributes Convert all CRLF line endings to LF. Jan 10, 2019
.gitignore
.travis.yml Split apart UnrecognizedEOF error variant from UnrecognizedToken (#446) Mar 25, 2019
CODE_OF_CONDUCT.md
Cargo.lock Version 0.16.3 Jan 20, 2019
Cargo.toml Remove lalrpop-snap Oct 21, 2018
LICENSE-APACHE Switch license to MIT/Apache2 instead of Unlicense, in an effort to be Jan 24, 2016
LICENSE-MIT
README.md
RELEASES.md
publish.sh
snap.sh
version.sh

README.md

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.
  • Gleam is a statically typed functional programming language for the Erlang VM.

Contributing

cargo test does not test that lalrpop generates a correct grammar for itself by default. So if you have made a change that would modify LALRPOP's own parser (lalrpop/src/parser/lrgrammar.rs) you need to run cargo test --all-features after making sure that a built lalrpop binary exists with cargo build -p lalrpop (see .travis.yml for the exact procedure).

You can’t perform that action at this time.