23 releases

0.10.0 Mar 29, 2021
0.9.2 Nov 29, 2020
0.9.0 Jul 6, 2020
0.6.2 Mar 22, 2020
0.1.1 Dec 18, 2018

#40 in Parser tooling

Download history 13/week @ 2020-12-24 25/week @ 2020-12-31 41/week @ 2021-01-07 38/week @ 2021-01-14 31/week @ 2021-01-21 55/week @ 2021-01-28 23/week @ 2021-02-04 215/week @ 2021-02-11 89/week @ 2021-02-18 39/week @ 2021-02-25 41/week @ 2021-03-04 67/week @ 2021-03-11 50/week @ 2021-03-18 150/week @ 2021-03-25 52/week @ 2021-04-01 92/week @ 2021-04-08

264 downloads per month
Used in 2 crates

Apache-2.0/MIT

175KB
3.5K SLoC

lrlex

lrlex is a partial replacement for lex / flex. It takes an input string and splits it into lexemes based on a .l file. Unfortunately, many real-world languages have corner cases which exceed the power that lrlex can provide. However, when it is suitable, it is a very convenient way of expressing lexing.

lrlex also has a simple command-line interface, allowing you to check whether your lexing rules are working as expected:

$ cat C.java
class C {
    int x = 0;
}
$ cargo run --lrlex java.l /tmp/C.java
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s
     Running `target/debug/lrlex ../grammars/java7/java.l /tmp/C.java`
CLASS class
IDENTIFIER C
LBRACE {
INT int
IDENTIFIER x
EQ =
INTEGER_LITERAL 0
SEMICOLON ;
RBRACE }

Dependencies

~2.8–4MB
~96K SLoC