News for hackers. Stuff that matters.
Re:Show HN: Writing my first interpreter in C for fun by pjmlp on Wednesday June 22, 2016 @02:50AM (#11952011)
Because many don't know any better and are stuck in 70's parser tools mindset.

Tools like ANTLR[0], SableCC[1], JavaCC[2], MPS[5] and approaches like Attribute Grammars[3], Parsing expression grammars[4] are much more suitable for the modern days.

I don't know gprolog, but SWI has GUI tooling, compilation and I was already using it in 1997, so it is very sound toolchain.

[0] - http://www.antlr.org/

[1] - https://github.com/SableCC/sablecc

[2] - https://javacc.java.net/doc/JJTree.html

[3] - https://wiki.haskell.org/Attribute_grammar

[4] - https://en.wikipedia.org/wiki/Parsing_expression_grammar

[5] - https://www.jetbrains.com/mps

Re:Show HN: Writing my first interpreter in C for fun by 91891879181 on Wednesday June 22, 2016 @04:10AM (#11952245)
I've tried Antlr and it was a horrible experience compared to Menhir: Being stuck with LL(n) causes a lot of unnecessary refactoring, the syntax for anything out of the ordinary is arcane and IMO not well documented.

Give me the 70's tools any day.

Re:Show HN: Writing my first interpreter in C for fun by pjmlp on Wednesday June 22, 2016 @07:27AM (#11952944)
You should of course use a tool that supports the grammar productions of the language being designed.

I just listed a few examples.

Re:Show HN: Writing my first interpreter in C for fun by groovy2shoes on Wednesday June 22, 2016 @04:16AM (#11952273)
Menhir is hardly a 70s tool...
Re:Show HN: Writing my first interpreter in C for fun by 99189198191 on Wednesday June 22, 2016 @04:44AM (#11952344)
This is true of course. But it is ocamlyacc compatible and uses a separate lexer.

I'd at least say that it is using the lex/yacc approach, which I actually like.

Re:Show HN: Writing my first interpreter in C for fun by sklogic on Wednesday June 22, 2016 @05:21AM (#11952486)
LL(n) can be limiting indeed. But you can easily mix, say, PEG and Pratt. Because where else do you need LR-like parsing but in the binary expressions, the C-style dot syntax and so on.