Creating a parser combinator library to parse JSON
| Prev: JSON numbers | Contents | Next: seq |
So what about many1? If I had a parser combinator many which matched zero or more things, and a combinator seq that matched several parsers in sequence (first thing A, then thing B, etc.), then I could write many1 as:
(def many1 (parser)
(seq parser
(many parser)))
which says that one way of matching “one or more of something” is to match one of them, followed by zero or more of that something.
Wow! Great! Progress! Now if only I had seq and many...
| Prev: JSON numbers | Contents | Next: seq |
Questions? Comments? Email me andrew.wilcox [at] gmail.com