🪄 A naive parser combinator written while learning Rust. Parsing magic tragic.
- 💖 Core
-
Parser: wrapper for parser function -
ParseLogger: logger for parser -
Parsable: anything that could be parsed
-
- 🐣 Primitives
-
CharStream: parse state for&str -
char: consumes one char at a time from parse stream -
satisfy: consumes one char if given condition satisifies -
literal: consumes given literal string -
regex: consumes literal string that matches given regular expression -
trim: constructs a parser that consumes whitespaces at both ends
-
- 🍡 Combinators
-
map: Maps the result of current parser to another value -
map_option:map, but automatically unwrapsOption<T> -
map_result:map, but automatically unwrapsResult<T, E> -
pure: injects value into an identity parser -
compose: compose one parser with another if applicable -
empty: a parser that always fails -
fix: fixed-point combinator for recursive syntax -
and: sequential combinator (pair) -
bind: monadic bind operator for context sensitive parsing -
left,right,mid: sequencial combinators (select left / right / middle) -
or: alternative combinators -
many,some,optional: replicative combinators -
info,warn,error: log combinators -
inspect: returns parser result alongwith current parsing state -
recover: returns a fallback value is given parser fails
-
- ✨ Enhancements
- Overload operators:
>>,<<,/,&,* -
Support returning multiple results - Advanced error handling (Planning)
- Overload operators:
- 🩺 Tests
- Tests for laws of Functor, Applicative and Monad.
- Arthimetic calculator
- Some more real-world tests (Planning)
- 📄 Docs
- Core
- Primitives
- Combinators