lex4oat is a Rust-based lexer for the Oat programming language. It features two lexing approaches:
- Library Lexer: Uses
lrlex
andlrpar
to tokenize the source. - Handcrafted Lexer: Builds an NFA and converts it to a DFA (see
src/lex4oat.rs
,src/nfa.rs
, andsrc/dfa.rs
) to perform tokenization.
- Tokenizes Oat source files (e.g.
a.oat
) - Demonstrates lexer construction using state machines (NFA & DFA)
- Provides both library-based and hand-made lexing techniques
- Uses
clap
for command-line argument parsing andenv_logger
for logging
cargo build
cargo run -- -f a.oat
docker buildx build . -t lex4oat:1
docker run -it --rm lex4oat:1 test/[].oat
The project includes a GitHub Actions workflow that builds and tests the project.