[WIP] Microparsec is a fast parser combinator library with excellent error messages.
import microparsec
let p = between(
ch('{'),
str("hello") >> many(space) >> str("world!"),
ch('}')
)
echo p.parse("{hello\n world?}")
Failed reading: satisfy
1:6:(13):
|
1 | world?}
| ^
unexpected '?'
expecting "world!"
Microparsec is a pure Nim adaptation of Parsec, the popular monadic parser combinator library for Haskell by Daan Leijen, Further inspiration was taken from Attoparsec and Megaparsec.
Microparsec supports Nim 1.2.6+ and can be installed using Nimble:
$ nimble install microparsec
- Leijen, Daan & Meijer, Erik. (2001). Parsec: Direct Style Monadic Parser Combinators For The Real World.
- Holden, Daniel. (2014). You could have invented Parser Combinators.
- Attoparsec (Haskell)
- Megaparsec (Haskell)
- Parsec (Haskell)