4 ms·
OK interesting, yeah I do see that if you consider how these expressions are parsed 1 + 1 * 42 1 + 1 + 1 * 42 1 + 1 + 1 + ... * 42 Or simply right
by chubot 3y ago
OK interesting, yeah I do see that if you consider how these expressions are parsed
1 + 1 * 42
1 + 1 + 1 * 42
1 + 1 + 1 + ... * 42
Or simply right associative operators.
I'm not sure how much the classification matters, similar to how I've concluded that pratt parsing vs. shunting yard doesn't seem to "matter" (both work)
But I have heard the "complaint" that pratt parsing is hard to understand, so maybe explaining it as a bottom up could help.
The arbitrary length subexpression prefix is really the problem that LR solves compared to LL (historically Python used LL parsing, and param=value and lvalue=rvalue are "overparsed" for this reason)
- Rusky 3y agoYeah- I tend to think of the whole vague collection of LR + shunting yard + Pratt as one single approach in my head, with the same capabilities in terms of parsing. Sometimes working through a particular problem, or conflict, or example is easier from one than the others, but knowing how they correspond (which is similar to how iteration and recursion correspond) means you can translate those ideas across.