Pegged, From EBNF to PEG

Philippe Sigaud philippe.sigaud at gmail.com
Sat Mar 17 10:36:46 PDT 2012


On Sat, Mar 17, 2012 at 15:48, Dmitry Olshansky <dmitry.olsh at gmail.com> wrote:

>> PEG sequences don't backtrack.
>
>
> I'd argue they do. As I see it as:
> Expr <- As B C D / B C D
> As <- A / A As

That's what people doing Regex-to-PEG translations do, yes. But it's
not the spontaneous behavior of A* B C D in PEG.

But that means I could add a switch to transform the expressions that way.


> (or use an epsilon production for As, is it allowed in pegged ?)

I called it 'Eps', it's a predefined parser that always matches and
consumes nothing.
I used the greek epsilon at the beginning (ε) but thought that many
people would shout at this :)


> OK, back to C-T parsing, I have one crazy idea that I can't get away from -
> add operator precedence grammar into the mix. From what I observe it should
> integrate into PEG smoothly. Then it would make "military-grade" hybrid that
> uses operator precedence parsing of expressions and the like. Few more
> tricks and it may beat some
> existing parser generators.
>
> See this post, where I tried to describe that idea early on:
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=159562

I remember reading this. But I don't feel I'm up to it for now.


> I might catch spare time to go about adding it myself, the only tricky thing
> is to embed plain semantic actions, as AST generation would be more or less
> the same.

Cool!


More information about the Digitalmars-d-announce mailing list