39 releases

0.13.10 Feb 28, 2025
0.13.8 Nov 7, 2024
0.13.7 Jun 14, 2024
0.13.4 Jan 4, 2024
0.1.1 Dec 18, 2018

#77 in Parser tooling

Download history 2431/week @ 2024-12-14 1821/week @ 2024-12-21 3595/week @ 2024-12-28 5453/week @ 2025-01-04 4956/week @ 2025-01-11 5026/week @ 2025-01-18 2597/week @ 2025-01-25 3722/week @ 2025-02-01 6027/week @ 2025-02-08 3231/week @ 2025-02-15 2999/week @ 2025-02-22 4374/week @ 2025-03-01 2922/week @ 2025-03-08 3692/week @ 2025-03-15 2947/week @ 2025-03-22 2030/week @ 2025-03-29

12,396 downloads per month
Used in 10 crates (8 directly)

Apache-2.0/MIT

510KB
12K 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

~5–13MB
~157K SLoC