News for hackers. Stuff that matters.
Re:Operator precedence by textual substitution by conaclos on Monday May 16, 2022 @07:04AM (#31395519)
The Wikipedia article about Operator Precedence Parser [1] is very informative. It describes this technique as well as other ones such as Pratt parser and precedence climbing.

[1] https://en.wikipedia.org/wiki/Operator-precedence_parser

Re:Operator precedence by textual substitution by shachaf on Monday May 16, 2022 @08:16AM (#31396045)
I would suggest against relying too closely on this article in its current state. The "precedence climbing" code is needlessly complicated -- it has a nested loop which doesn't do anything, only one loop is necessary -- and it doesn't really explain what's going on (which is a relatively simple idea), just writes some pseudocode and mechanically evaluates it.