#lalr-parser #lalr #parser

lalry

a library for creating LALR(1) parsers from context-free grammars

1 unstable release

Uses old Rust 2015

0.1.0 Jun 8, 2024

#3 in #lalr

Download history 94/week @ 2024-06-25 72/week @ 2024-07-02 81/week @ 2024-07-09 73/week @ 2024-07-16 112/week @ 2024-07-23 67/week @ 2024-07-30 134/week @ 2024-08-06 98/week @ 2024-08-13 127/week @ 2024-08-20 133/week @ 2024-08-27 152/week @ 2024-09-03 112/week @ 2024-09-10 83/week @ 2024-09-17 116/week @ 2024-09-24 81/week @ 2024-10-01 140/week @ 2024-10-08

439 downloads per month
Used in 11 crates (via parol)

MIT/Apache

55KB
1K SLoC

lalry - a library for creating LALR(1) parsers from context-free grammars

This is a fork of the great lalr crate, a library for creating LALR(1) parsers from context-free grammars.

Additions to lalr

To make the generation of parse tables more flexible lalry adds a way to control this process. The trait Config is used for this and a custom implementation can be provided to deviate from the default. To keep the default behavior as in previous versions the user can use the DefaultConfig structure that provides the implementation of the standard behavior.

Properties of lalry

lalry, although not the main goal, is functionally fully compatible with it's ancestor lalr. It can be used as drop-in replacement with only minor adaptions.

All you need to do is to create a DefaultConfig and hand it over to the call to lalr1:

let config = DefaultConfig::new();
let parse_table = grammar.lalr1(&config).unwrap();

By using a default configuration you get the exact same functionality as if you had called

let parse_table = grammar.lalr1(|_, _| true, |_, _| 0).unwrap();

with lalr style API.

No runtime deps