Hacker News
points by direwolf20 4 days ago | 0 comments
Is this the same algorithm commonly known as "recursive descent" parsing and one of the oldest parsing algorithms? The array index example is just recursive descent and the expression parsing is recursive descent with abstracted operators instead of a parsing function per precedence level.

GCC used to use a type of parser generator but switched to recursive descent because the C language is just a little bit too dynamic to make it work well (EG typedefs). They specifically cited the advantage that because you are writing actual code to parse each production rule, you can break the conventions when needed.

[–] YuechenLi 4 days ago
Recursive descent and Pratt are two different but related parsing methods. Pratt is simpler and recursive descent is more explicit, but it's not an "either/or" thing since a parser can use both methods.
[–] ogogmad 4 days ago
I personally think that Pratt is a combination of recursive descent and precedence-climbing. Maybe even the combination? Those ideas are individually older than Pratt.
Hacker News