Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Idiots don't know how to parse...

Name: Cudder !cXCudderUE 2015-11-13 8:45

http://stackoverflow.com/questions/28256/equation-expression-parser-with-precedence

WTF? The accepted answer is from someone who thinks recursive descent is "hard" and a ridiculously bloated parser-generator is "easy"? Pure bisonshit! Almost every real (and toy) compiler uses some variant of recursive-descent. Even GCC, which would probably be the biggest user of Bison, moved to recursive-descent years ago.

These aren't even programmers, these are Java-sipping codemonkeys who know next to nothing about how anything really works and can only parrow "reinventing the wheel" and other "enterprise best practices" bullshit.

Name: Anonymous 2015-12-02 23:28

>>37 has never written a parser. I can tell from having written some parsers myself and from the sheer retardation of her comment.

Come sit on my knee and listen, >>37-chan: you see, the problem when you're parsing a list of function arguments and suddenly encounter "3 + ," is that you encounter the comma when balls deep in the "trying to parse a multiplicand", and at that point you can't say anything more helpful than "I expected a multiplicand or an "(", but got a comma, wtf".

And that's not helpful, my dear >>37. That's not helpful at all, there's not a multiplication operator in sight even, why do you complain about multiplicands? Why are you not helping?

Because to make a helpful error message you got to collect all possibilities from the entire stack trace that got you to that point and weigh them by importance, so that the part where the "+" was expecting something on the right side is more important than what happened deep down below, but also more important than what the "parse a function" expected from that entire list of arguments, or even more so than "parse a program".

And the only way you can do it, my sweet >>37, is by reifying your formal grammar and making a generic parser that can do that figuring out what was expected when a grammar rule failed to apply, and which grammar rule really failed to apply.

*tousles >>37-chan's hair* go play with your legos little one, you are not ready for this.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List