| Crates.io | expr_parser |
| lib.rs | expr_parser |
| version | 0.0.1 |
| created_at | 2019-04-26 21:55:00.158162+00 |
| updated_at | 2019-04-26 21:55:00.158162+00 |
| description | A lexer and parser of simple arithmetic expressions. |
| homepage | |
| repository | https://github.com/DanielSchuette/expr_parser |
| max_upload_size | |
| id | 130376 |
| size | 31,494 |
A simple program that takes expressions like 5 + 8 * (7-1) and parses them into a syntax tree. GRAMMAR.md explains the process in greater detail. A few things will be implemented like executing the syntax tree that lexer and parser create. This is really just an experiment to see how a context-free grammar-based parser might be implemented in Rust.
A Makefile makes running the code in this repository easy:
make
make test # runs the binary with appropriate parameters (especially `-e <expr>')
make err1 # demonstrates an error; `err2' and `err3' exist, too
But cargo can be used, too. E.g., install the binary from crates.io with:
cargo install expr_parser
expr_parser --help # validates a successful installation
graphviz must be installed on your system. If you make and make test, .gv and .pdf files will be created in the project root. Refer to the Makefile or run make help for available parameters.
evaluate function[], log2, log10$var syntax), using a stack machineThe code in this repository is MIT-licensed (see LICENSE.md).