Asciimath Parser
================
[](https://crates.io/crates/asciimath-parser)
[](https://docs.rs/asciimath-parser)
[](LICENSE)
[](https://github.com/erikbrinkman/asciimath-parser/actions/workflows/rust.yml)
A fast extensible memory-efficient asciimath parser
This parser produces a parsed tree representation rooted as an `Expression`.
The parsed structure keeps references to the underlying string in order to avoid
copies, but these strings must still be interpreted as the correct tokens to
use the structure.
## Usage
```sh
cargo add asciimath-parser
```
then
```
asciimath_parser::parse("x / y");
```
### Performance
This library is meant to be a fast extensible parser. Most other rust libraries parse and format,
or parse and evaluate, but don't expose their underlying parsing logic. This parser produces a
relatively simple parse tree whose tokens are slices of the input, so it does no extra string
allocation. The `parse` bench measures parsing a corpus of hand-written examples and a batch of
random expressions:
```
test example ... bench: 2,232 ns/iter (+/- 115)
test random ... bench: 113,775 ns/iter (+/- 6,033)
```