What the heck is a parser-combinator?
kimpel.com
What the heck is a parser-combinator?
1–10 of 74 posts
Re: What the heck is a parser-combinator?
#2Re: What the heck is a parser-combinator?
#3PEGTL - C++ Parsing Expression Grammar Template Library https://github.com/taocpp/PEGTL
Parboiled - Java & Scala PEG Library https://github.com/sirthias/parboiled
Nom - Rust parser combinator framework https://github.com/Geal/nom
Nearley - JavaScript parser toolkit https://github.com/Hardmath123/nearley
Neotoma - Erlang library and packrat parser-generator for PEGs https://github.com/seancribbs/neotoma
Re: What the heck is a parser-combinator?
#4Re: What the heck is a parser-combinator?
#5Re: What the heck is a parser-combinator?
#6Gotta love Parsec for Haskell and pyparsing for Python. Some other awesome parsing libs: PEGTL - C++ Parsing Expression Grammar Template Library https://github.com/taocpp/PEGTL Parboiled - Java & Scala PEG Library https://github.com/sirthias/parboiled Nom - Rust parser combinator framework https://github.com/Geal/nom Nearley - JavaScript parser toolkit https://github.com/Hardmath123/nearley Neotoma - Erlang library a…
There's a great walk-through of using it here, including fuzzing your parsers to make sure they're solid. https://github.com/Geal/langsec-2017-hackathon-code
Re: What the heck is a parser-combinator?
#7Re: What the heck is a parser-combinator?
#8Re: What the heck is a parser-combinator?
#9 string("foobar") : Parser
char : Parser
always(x: A): Parser
never: Parser
These are parser combinators. They form the atoms at the foundation of a language for constructing parsers. For instance, we can imagine two parsers happening in sequence then(a: Parser, b: Parser): Parser
then(char, char): Parser
Or more fancily, a two parsers happening in sequence, but the second parser being defined using the output of the first. This creates context sensitivity thenDependent(a: Parser, b: A -> Parser): Parser
We're constructing a fundamental language for building parsers up from our atoms to larger and larger things. All we need now is a way to "run" them run(p: Parser): String -> Option
Tada---parser combinators!Re: What the heck is a parser-combinator?
#10Gotta love Parsec for Haskell and pyparsing for Python. Some other awesome parsing libs: PEGTL - C++ Parsing Expression Grammar Template Library https://github.com/taocpp/PEGTL Parboiled - Java & Scala PEG Library https://github.com/sirthias/parboiled Nom - Rust parser combinator framework https://github.com/Geal/nom Nearley - JavaScript parser toolkit https://github.com/Hardmath123/nearley Neotoma - Erlang library a…
The library has a well-written tutorial that doesn't require previous knowledge about parser combinators.