lex4oat is a Rust-based lexer for the Oat programming language. It features two lexing approaches:
- Library Lexer: Uses
lrlexandlrparto 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
clapfor command-line argument parsing andenv_loggerfor logging
cargo buildcargo run -- -f a.oatdocker buildx build . -t lex4oat:1
docker run -it --rm lex4oat:1 test/[].oatThe project includes a GitHub Actions workflow that builds and tests the project.