term ::= factor ( ('*' | '/') factor )* ;
If you introduce regex-like closure operators to model loops, life gets much easier, and you can build your trees the right way around.How applicable this is to PEGs is another matter though. I generally write my parsers by hand, and I parse expressions with operator precedence.
And for stuff that LL(1) can't handle, I think GLR is a better approach.
In the simplest version, each rule can be seen as a function that calls other rules, passing along a memo table as it goes. It's entirely stateless and functional, except for the memo table. In addition, each function is only a few lines.
Backtracking isn't a hack--it's the natural result of statelessness. There's no cursor that needs to be backtracked.
Asking the user to have to worry about this stuff, when he doesn't have to, is not good software design. Not all of us are writing high performance parsers for complicated languages.
The issue is that a top-down grammar cannot handle left-recursion, since it naturally leads to infinite recursion when being parsed from the top down.
I actually had to handle the left-recursion problem for a PEG I wrote in-house--right now I'm trying to convince my boss to let me open-source it :)