News for hackers. Stuff that matters.
Re:Show HN: How to write a recursive descent parser by Arelius on Monday March 20, 2017 @04:31PM (#13917422)
Yeah, so we can spend a long time trying to find a parser generator that can solve all of our problems in the language that we use, which may or may not exist. Or you could just spend the same time to just write the parser. It turns out that writing a parser just isn't that hard, and in the time that you spend wavering on which parser generator to use, you could have most of your parser done.
Re:Show HN: How to write a recursive descent parser by wtetzner on Monday March 20, 2017 @11:09PM (#13919557)
> and in the time that you spend wavering on which parser generator to use, you could have most of your parser done.

Maybe, but if you want all of the features mentioned above (incremental parsing etc.), then writing a parser becomes much more complicated.

Re:Show HN: How to write a recursive descent parser by bd82 on Tuesday March 21, 2017 @08:17AM (#13921483)
Or you could take the middle ground and use a library meant to make it easier to create hand built parsers. as opposed to a library that generates a parser for you.

* Repo: https://github.com/SAP/chevrotain

* Online Playground: http://sap.github.io/chevrotain/playground/

This handles the repetitive parts such as lookahead functions creation or Parse Tree building, while also providing advanced features such as error recovery or syntactic content assist (auto complete).

* ECMAScript family of languages supported (JavaScript/TypeScript/CoffeeScript).

Re:Show HN: How to write a recursive descent parser by fooker on Tuesday March 21, 2017 @06:13AM (#13920942)
Not really, it is rather easy to hack features into a recursive descent parser. That is is the main reason almost all production compilers are written that way.

With a parser generator, it quickly becomes a game of designing your language and its semantics around the limitations of the generator you are using.