Is there a simple and intuitive explanation for the fact that the following parsing expression (where S
is the starting symbol, $
denotes end-of-string and /
is ordered choice)
S <- X $
X <- 'a' X 'a' / 'aa'
only matches strings of 'a's with a length that is a power of 2? (The same grammar interpreted as a CFG would match strings of 'a's with a length that is a multiple of two.)
And how can PEGs be suitable for the specification of computer languages if ordered choice makes the language defined by a PEG that unintuitive to understand?