#tiny #combinator #parser #simple

tinyparse

A tiny combinator parser library

4 releases

0.2.3 May 1, 2022
0.2.2 May 1, 2022
0.2.1 May 1, 2022
0.1.1 May 1, 2022
0.1.0 May 1, 2022

#229 in Parser tooling

GPL-2.0 license

18KB
330 lines

Tinyparse

A tiny library for parsing simple expressions.

Quickstart

use tinyparse::common;
use tinyparse::{Span, Parse};

let hello_or_int = common::literal("hello!").or(common::int());
// The parse functions return a result containing what's left of "10" and the actual result.
assert_eq!(hello_or_int.parse(Span::new("10")), Ok((Span::empty(), 10)));

Limitations

Some expressions need lookahead capability or something similar to be parsed. Unfortunately; this library does not include this.
If you want lookahead capability, consider implementing your own parser using the Parse trait.

Note: This library is a work in progress. New things are getting added and breaking changes may occur.

No runtime deps