https://github.com/bmyjacks/lex4oat
Rust-based lexer for the Oat programming language
https://github.com/bmyjacks/lex4oat
lexer oat rust
Last synced: 1 day ago
JSON representation
Rust-based lexer for the Oat programming language
- Host: GitHub
- URL: https://github.com/bmyjacks/lex4oat
- Owner: bmyjacks
- Created: 2025-03-11T01:17:40.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-03-17T10:40:51.000Z (7 months ago)
- Last Synced: 2025-03-17T11:37:27.957Z (7 months ago)
- Topics: lexer, oat, rust
- Language: Rust
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lex4oat
lex4oat is a Rust-based lexer for the Oat programming language. It features two lexing approaches:
- **Library Lexer:** Uses [`lrlex`](src/liblex4oat.rs) and [`lrpar`](src/liblex4oat.rs) to tokenize the source.
- **Handcrafted Lexer:** Builds an NFA and converts it to a DFA (see [`src/lex4oat.rs`](src/lex4oat.rs), [`src/nfa.rs`](src/nfa.rs), and [`src/dfa.rs`](src/dfa.rs)) to perform tokenization.## Features
- Tokenizes Oat source files (e.g. [`a.oat`](a.oat))
- Demonstrates lexer construction using state machines (NFA & DFA)
- Provides both library-based and hand-made lexing techniques
- Uses [`clap`](Cargo.toml) for command-line argument parsing and [`env_logger`](Cargo.toml) for logging## Getting Started
### Build
```shell
cargo build
```### Run
```shell
cargo run -- -f a.oat
```### Docker
```shell
docker buildx build . -t lex4oat:1docker run -it --rm lex4oat:1 test/[].oat
```### Testing & CI
The project includes a GitHub Actions workflow that builds and tests the project.