In "Packrat Parsing: a Practical Linear-Time Algorithm with Backtracking" on page 30 the author states that the context-free grammar (CFG):
S -> a S a | a S b | b S a | b S b | a
appears not to have a corresponding parsing expression grammar (PEG).
The above CFG is equivalent to:
S -> (a | b) S (a | b) | a
and can be summarized as "odd number of a's and b's with an 'a' in the middle". However the strait-forward translation of this to a PEG:
S <- (a / b) S (a / b) / a
seems to work fine and code for the same language.
You can try this out yourself online using peg.js (enter the grammar as S = ('a' / 'b') S ('a' / 'b') / 'a'
).
Is the author wrong or am I misunderstanding something?