#parser-combinator #combinator #input #extract

ruminant

An exploration into implementing parser combinators

16 breaking releases

0.17.0 Sep 29, 2023
0.15.0 Sep 15, 2023
0.10.0 Jun 19, 2023

#169 in Parser tooling

Download history 35/week @ 2024-07-01 66/week @ 2024-07-29

108 downloads per month

MIT license

20KB
422 lines

ruminant, a parser combinator library

Deprecated See my latest stab at this: parser-compose

⚠️ Warning ☣️
Homemade, hand-rolled code ahead. Experimental. May not function as advertised.

This is an introduction by example. For a first-principles introduction to parser combinators see here.

  • A parser is a function that takes some input in, extracts some information and returns the result of this extraction. In order to make any progress, the result contains the leftover input after consuming some part of it, or in the case of error returns some value indicating failure.

  • A combinator takes one or more parsers as input and returns a different parser. They are useful for uhh...combining multiple parsers together or even changing what parsers do.

With only these two ideas the world becomes your oyster.

Examples coming sooon

No runtime deps