Lexigram
This crate is part of the Lexigram project, a lexer/parser generator.
Main distinctive features:
- Generation of non-recursive LL(1) and LALR(1) parsers (for now).
- LL: automatic transformation of left-recursive/ambiguous rules and left factorization.
- LL/LR: conflict resolution in parsing tables for ambiguous rules according to priority and associativity.
- Grammar-driven listener pattern for better flexibility and to avoid mixing grammar with Rust source code.
- Listener methods called directly during parsing, rather than after reconstructing a concrete syntax tree.
- Low-latency variants for right-recursive rules (in LL) and
*/+repetitions. - Grammar syntax and listener support for repetitions separated by tokens (e.g.
(Id ':' Type / ',')+) - Ability to parse continuous input streams.
You can dive into the Lexigram book for an introduction, a tutorial, or a reference. You can also browse the crate documentation.
If you're looking for the command-line executable, you'll find it in the lexigram crate, along with a quick overview.
The lexigram-lib Crate
The lexigram-lib crate contains the low-level code that generates a lexer and a parser.
It's normally not meant to be used for other purposes than a dependency of the following crates, unless you want to create the lexicon and the grammar programmatically.
lexigram, the command-line lexer & parser generatorlexi-gram, the high-level methods and objects to generate a lexer & parser from Rust code
Status
This project is still under development and shouldn't be considered fully stable yet (hence the 0.x version). The main upcoming changes required before a stable version are:
- for the tools
- check robustness in corner cases, in particular by detecting problematic syntactic and lexical rules
- improve error messages
- for the generated code
- improve performances
- for bottom-up parsers (still in development in a branch)
- add error recovery, token interception and other missing features of LL(1) generator
- extend to safer LR parsers than LALR
The code and the documentation were entirely written by a human (strict non-AI policy).
Releases
RELEASES.md keeps a log of all the releases (most are on the repository release page, too).
Licence
This code is licensed under either MIT License or Apache License 2.0, at your option.