From: Clifford Heath Date: 2008-01-29T14:19:58+09:00 Subject: Re: Treetop Email Parser Phrogz wrote: > On Jan 28, 8:41 pm, Phrogz wrote: > My apologies for second guessing you. Having read the PEG paper[1], I > see now what you're saying. Well, though the authors of the packrat paper described a parser that behaves that way, I don't think it's fair to limit the possible other behaviours of any PEG parser generator. IOW, PEG >= packrat. ANTLR is also LL(*), but avoids this problem by analyzing the expressions and either rejecting or re-writing them. > So...how would you write a PEG rule to match "a string of any number > of vowels, that ends with an 'e'"? Assuming some EOF token (not provided free by Treetop) you'd write: (!('e' EOF) [aeiou])* 'e' Of course, in many cases, EOF would be replaced by a white-space or other rule. Clifford Heath.