From: Clifford Heath Date: 2010-08-17T10:30:05+09:00 Subject: Re: Parsing, BNF, TreeTop, GhostWheel, ... (Sent previously, but it didn't appear. Sorry if you get this twice). Philipp Kempgen wrote: > Is this a problem with packrat/PEG parsers in general? Yes. PEG parsers are greedy (iterate as far as possible and never backtrack on that), and also take the first alternative that succeeds, without trying subsequent alternatives. It's actually quite useful and natural, once you get the hang of it. Pure PEGs have no lookahead, as Treetop does. It's often necessary though, in the light of the above. Also, your approach will yield the wrong results when you add '-' into the mix, because of associativity. "1-2-3" will calculate as 1-(2-3). A better way is to use iteration, see Clifford Heath.