Let's stop parser Hell

Roman D. Boiko rb at d-coding.com
Sat Jul 7 13:05:34 PDT 2012


On Saturday, 7 July 2012 at 19:58:37 UTC, Roman D. Boiko wrote:
> On Saturday, 7 July 2012 at 19:50:37 UTC, Timon Gehr wrote:
>> http://en.wikipedia.org/wiki/Operator-precedence_parser#Precedence_climbing_method
>
> OK, at least I didn't misunderstand. So my question was whether 
> the alternative that I described and which exists in PEG is 
> somehow worse than OPP. Wikipedia seems to provide an answer to 
> that: OPP tend to be simpler. (I didn't investigate this topic 
> further.)
OK, now I agree, the need to perform several nested calls in 
order to parse some expression is costly enough to consider OPP 
superior to a general PEG for expressions.

At first I was surprised when found that D doesn't define 
operator precedence explicitly, but instead provides a hierarchy 
of expression types. Then I somehow concluded that the approaches 
are equivalent. (I started learning parsing techniques only in 
February '12.) Since then I never reconsidered my past 
conclusions.


More information about the Digitalmars-d mailing list