On Wed, Mar 14, 2012 at 10:48, Dmitry Olshansky <dmitry.o...@gmail.com> wrote:
>> That's one of the caveats on PEG. That and greedy operators. >> >> 'a*a' never succeeds because 'a*' consumes all the available a's. >> > > Hey, wait, I thought there has to be backtrack here, i.e. when second 'a' > finally fails? PEG only do local backtracking in 'or' choices, not in sequences. I think that's because the original author was dealing with packrat parsing and its O(input-size) guarantee. I remember trying compile-time backtracking in another similar library in D 1-2 years ago and getting lots of pb. I might add that in Pegged, but I don't know the consequences. How do you do that in std.regex? (nice article btw, I learnt some about regexes)