3 ms·
Precedence climbing solves these problems. This article is from 2009. Same blog 2012: http://eli.thegreenplace.net/2012/08/02/parsing-expressions-by-precedence
by qznc 12y ago
Precedence climbing solves these problems.
This article is from 2009. Same blog 2012: http://eli.thegreenplace.net/2012/08/02/parsing-expressions-by-precedence-climbing http://eli.thegreenplace.net/2012/08/02/parsing-expressions-...
- timtadh 12y agoYeah but no. That is no longer a recursive descent parser it is a hand written Shift-Reduce parser. Nothing wrong with that just a totally different parsing technique. He also covers several other interesting techniques on his blog. However, the "standard" solution is the one given in my comment above. As long as you can transform your grammar in to the correct form. Aho et. al give the fully general algorithm for conversion as I mentioned.
- qznc 12y agoOk, I agree that "standard" is grammar transformation. I'd argue that precedence climbing is "better", which means it provides a bunch of benefits and nearly no downsides in practice.