Crates.io | asciimath-parser |
lib.rs | asciimath-parser |
version | 0.1.1 |
source | src |
created_at | 2023-03-05 23:17:45.067108 |
updated_at | 2023-03-05 23:18:59.949542 |
description | A fast extensible memory-efficient asciimath parser |
homepage | |
repository | https://github.com/erikbrinkman/asciimath-parser |
max_upload_size | |
id | 801851 |
size | 81,538 |
A fast extensible memory-efficient asciimath parser
This parser produces a parsed tree representation rooted as an Expression
.
The parsed structure keeps refrences to the underlying string in order to avoid
copies, but these strings must still be interpreted as the correct tokens to
use the structure.
cargo add asciimath-parser
then
asciimath_parser::parse("x / y");
This library is meant to be a fast extensible parser. There are a number of rust libraries that
parse and format, or parse and evaluate, but don't expose their underlying parsing logic. Only
asciimath_rs
actual parses expressions. However, that parser allocates extra strings, and
produces a relatively complicated parse tree. This creates a relatively simpler parse tree with
string slices as tokens. This allows this parser be several times faster than asciimath_rs
.
test asciimath_parser::example ... bench: 7,912 ns/iter (+/- 1,348)
test asciimath_rs::example ... bench: 41,605 ns/iter (+/- 14,262)
test asciimath_parser::random ... bench: 360,495 ns/iter (+/- 32,231)
test asciimath_rs::random ... bench: 2,522,810 ns/iter (+/- 168,133)