* See: "What do you think are the problems people will try to solve with ANTLR4?" question
I've used several different parser generators in the past.
But I've also transitioned to hand-rolled recursive decent parsers, being Lazy I've created a library to assist in hand-rolling a recursive decent parser: https://github.com/SAP/chevrotain
I develop a parsing library for fun and I don't think
that would be an easy or useful interview question.
Maybe it makes sense if you assume the input has already been tokenized so you are not expected to deal with the minutiae of string literal escape sequences and such and can focus on the high level design/flow...
What is interesting imho is that Chevrotain is not a Parser Generator
nor a Parser Combinator. It is a tool that makes it easier to craft hand built recursive decent parsers rather than a whole new level of abstraction.
I kept putting of switching from Travis to Circle-CI in one of my open source projects, But when I did get around to it the whole thing went pretty smoothly and easily and I regret not doing it earlier.
1.The builds are much faster now.
2. The configuration has virtually no hacks anymore as I'm using Circle-CI own docker images (including browsers).
3. And the UI/UX is superior as well.
If you are looking for an alternative to standard parser generators
you may wish to have a peek at Chevrotain.
* https://github.com/SAP/chevrotain
Instead of using an abstraction of a declarative grammar definition and code generation to provide an alternative to writing a parser by hand, Chevrotain simplifies the process of hand crafting a parser.
Meaning no code generation and you can still directly debug the code you have written (unlike most parser combinators).
Chevrotain is an LL(K) Parser library,
or more precisely SLL(K), It looks up-to K fixed token ahead to choose the next alternative.
Because it is just a library to assist in hand crafting recursive decent parsers, the same limitations apply, left recursion would lead to an infinite loop...,however left recursion is detected during initialization and an descriptive error is thrown instead.
However in general, the library does not try to be able to parse all the possible grammars in the world, instead the focus is more on performance, features and ease of development.
It is implemented using a parsing library so the lookaheads are automatically performed by the library, but the general pattern is still relevant.
Basically each binary precedence level gets a rule (weakest first) and each of these rules will consume as many operators of the current precedence level as it can.
* https://github.com/antlr/antlr4/blob/master/doc/faq/general....
* See: "What do you think are the problems people will try to solve with ANTLR4?" question
I've used several different parser generators in the past. But I've also transitioned to hand-rolled recursive decent parsers, being Lazy I've created a library to assist in hand-rolling a recursive decent parser: https://github.com/SAP/chevrotain