3 ms·
Just write recursive descent, except for the infix operator precedence, and then use a tiny stack that you either push to or pop from (shift/reduce, ala LR) bas
by titzer 4y ago
Just write recursive descent, except for the infix operator precedence, and then use a tiny stack that you either push to or pop from (shift/reduce, ala LR) based on the relative precedence.
Pretty much all compilers that have fast parsers that also give good error messages are hand-written recursive descent.