https://github.com/nathom/expr-parser
LL(1) arithmetic expression parser in Rust
https://github.com/nathom/expr-parser
Last synced: about 1 month 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 (11 months ago)
- Default Branch: main
- Last Pushed: 2024-06-10T06:02:33.000Z (11 months ago)
- Last Synced: 2025-04-05T14:45:47.142Z (about 1 month 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
```