p-( ㅅ )
— the inelegant parser
p-arse
is a PEG parser library focused on readability and type safety • it follows the syntax from the original paper as closely as possible • the parsers are point-free (they're (mostly) variables, not functions), as opposed to nom
's parsers which are functions or compositions of functions • this encourages the user to bind and name many intermediate parsers • it is similar to pest
in this regard
warning: the project is in an early stage
example
let parse_hex_dd = ;
let construct_color = ;
let hex_d = .or;
let hex_dd = .maps;
let color = .r0.map;
let = color.p_arse.unwrap;
check out other examples • i've some replicated examples from the other parser libaries, i.e. nom
's hex color (mine), pest
's ident list (mine) and pom
's json (mine)
todo
- add docs
- add verbose error messages
- allow access to the string slice captured by the parser (its children's captures concatenated) (kinda works, except where
.rn()
is used)