Robin Lee Powell wrote:
> On Tue, Apr 28, 2009 at 10:10:26AM +0200, Alexander Bernauer wrote:
>> First, section 3.4 defines a PEG for the context free language
>> L = {a^n b^n c^n | n > 0 } like this:
>>
>> ---8<--- 
>> A <- aAb/e
>> B <- bBc/e
>> D <- &(A !b) a* B !.
>> --->8---
>> (e means epsilon)
>>
>> But this grammar matches the word "aabc" which is not an element of L.

Yes.

>> I think the grammar should be fixed like
>> ---8<---
>> A <- aAb/e
>> B <- bBc/e
>> D <- &(Ac) a* B !.
>> --->8---
> 
> I tried, but I can't see a problem with this; I think you're
> correct.

This looks correct to me as well. I thought at first that it
was a problem that &(Ac) a* B !. does not match the empty string,
but L is defined with n > 0.

-- 
David-Sarah Hopwood ⚥


_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to