For the precedenced rules, you create new symbols for each precedence, proceeding with associativity in the obvious way. Much of it is done in this routine: https://github.com/jeffreykegler/Marpa--R2/blob/master/cpan/lib/Marpa/R2/MetaAST.pm#L568
One thing to note is that it is *not* operator precedence -- the rule have precedence, and the operators play no special role. It's not dissimilar to rewrites you'll see elsewhere, but I might be its inventor, if only because nobody previously had a parser that could be expected to parse the rewritten rules. On Fri, Mar 6, 2015 at 11:22 AM, Andreas Kupries <[email protected]> wrote: > > > On Thu, Mar 5, 2015 at 4:51 PM, Jeffrey Kegler > <[email protected]> wrote: >> >> Quantified rules are semantic sugar for BNF, and you can write BNF rules >> and have access to all the symbols in them, including those you think of as >> separators. I say "think of", because if separators are given a semantics, >> they are (conceptually) more than just separators. Sequences can be written >> as recursions -- internally, that is what Marpa::R2 actually does. > > > Is there any documentation around on how Marpa::R2 rewrites the sugar into > basic BNF ? > > Ok, I know how it can be done for the quantified rules, via left recursion > and additional non-terminals. However for the priority rules I am still not > fully clear how these would be done. > > If there is no documentation, then is the rewrite engine in some > central/singular place in the sources, or is its activity distributed > through it, and where would I have to look ? > > > >> >> Use a left recursion, because that is easier on Marpa's internals. >> > > -- > You received this message because you are subscribed to the Google Groups > "marpa parser" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
