https://github.com/nathom/expr-parser
LL(1) arithmetic expression parser in Rust
https://github.com/nathom/expr-parser
Last synced: 8 months ago
JSON representation
LL(1) arithmetic expression parser in Rust
- Host: GitHub
- URL: https://github.com/nathom/expr-parser
- Owner: nathom
- Created: 2024-06-10T04:59:08.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-10T06:02:33.000Z (about 2 years ago)
- Last Synced: 2025-06-25T22:54:30.619Z (12 months ago)
- Language: Rust
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Arithmetic Expression Parser
A dependency-free lexer, parser, and evaluator for integer arithmetic
expressions.
It uses predictive, top-down, recursive descent parsing by implementing the
LL(1) expression grammar given in `Expr.abnf`. Thus, with only a single token of
lookahead, we are able to evaluate an arbitrary expression with correct rules of
precedence.
## Usage
Running the program will show the parse tree and result for the input.
```bash
cargo run
```
Type in the input, and hit return.
## Run tests
To run all tests, run
```bash
cargo test
```