NimbleParsec - a simple and fast parser combinator for Elixir

That’s actually a pattern that the C++ Spirit supports (it can accept any kind of iterable, not just strings), and my ExSpirit follows the same conventions. The only things that assume strings are the things in the Text module. It would be very trivial to create a, oh, Matcher module or token matching (you can create it in user code with ease, a single function would probably work very well, I think C++'s token parsing uses just a single terminal to handle it all). The main ExSpirit library is agnostic to what is actually being parsed (ignoring a few things like eoi and lexemethat I really should protocolize or at least handle a few erlang-style forms of). But parsing non-strings was entirely in mind when it was designed. :slight_smile:

It absolutely does in most parsers, but you really should try the C++ Spirit design, many modern PEG libraries have copied it’s style for a reason.

It’s not always what I need either, like the C++ Spirit library I’ve used to parse bytecode streams, walk and decompose trees, etc… It is an extremely powerful data transformation library from something that is iterable to something that is structured and vice-versa (so many people miss the nice vice-versa part). :slight_smile:

Yep this! It’s really easy to define your own terminals in user-code. :slight_smile: