No description
Find a file
Dario Balboni d098696de6 Fix error in not considering the result of the second argument of <*
Previous implementation was discarding the Result[T] for <*, which meant that writing
```nim
many(digit) <* eof
```
did also match `8394   483` because the eof would fail but such result would be discarded.

Instead what we want is to also try to parse the second result and if it fails then we return a failure,
otherwise we return only the first correctly parsed result.
2021-09-01 11:20:36 -03:00
docs Implement newline parsers 2021-07-07 23:48:35 -03:00
src Fix error in not considering the result of the second argument of <* 2021-09-01 11:20:36 -03:00
tests Fix error in not considering the result of the second argument of <* 2021-09-01 11:20:36 -03:00
.gitignore Ignore extensionless files 2021-06-23 19:58:13 -03:00
LICENSE Initial commit 2021-06-19 11:22:48 -03:00
microparsec.nimble Generate documentation (fix #39) 2021-07-04 23:03:55 -03:00
README.md Add some whitespacek 2021-08-31 14:12:01 -03:00

Documentation

Microparsec

[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.

Installation

Microparsec supports Nim 1.2.6+ and can be installed using Nimble:

$ nimble install microparsec

Some references

Inspiring projects