parlex-gen
Lexer and parser generator tools for Rust.
Overview
parlex-gen provides two code generation tools:
alex: Regex-based lexer generator for creating tokenizers from lexical specificationsaslr: SLR parser generator for building parsers from grammar definitions
Both generators produce code that uses the parlex runtime library.
Features
- Generate regex-based lexers with
alex - Generate SLR parsers with
aslr
Installation
Add this to your Cargo.toml:
[]
= "0.1"
You'll also need the runtime library:
[]
= "0.1"
Usage
Lexer Generation with alex
Create a lexer specification file and use alex to generate a lexer:
// In your build.rs
use alex;
Parser Generation with aslr
Create a grammar file and use aslr to generate an SLR parser:
// In your build.rs
use aslr;
Architecture
The generation process follows these steps:
- Specification: Define your lexer rules or grammar
- Generation: Run
alexand/oraslrto generate Rust code - Integration: The generated code uses
parlextraits and data structures - Customization: Build your custom lexer/parser using the generated code and
parlex
Documentation
For detailed API documentation and examples, visit docs.rs/parlex-gen.
License
Copyright (c) 2005–2025 IKH Software, Inc.
Released under the terms of the GNU Lesser General Public License, version 3.0 or (at your option) any later version (LGPL-3.0-or-later).
See Also
- parlex - Runtime support library
- Main repository