Andreas: Actually, it occurs to me that I can work up an example from
Marpa's internal trace mechanisms, showing the internal rules.  I'm
away from my development environment now, but I'll do that in a bit.

On Fri, Mar 6, 2015 at 12:30 PM, Andreas Kupries
<[email protected]> wrote:
> On Fri, Mar 6, 2015 at 12:08 PM, Jeffrey Kegler
> <[email protected]> wrote:
>> No.  Sorry if I was not clear.
>
> No problem.
>
>>
>> The rewrite for precedenced rules removes the ambiguity of the pure
>> BNF in the SLIF DSL, and in this way is very much like the one you see
>> described elsewhere, particularly for dealing with expressions using
>> top-down parsers.  You add a new symbol for the expression at each
>> level of precedence, and the rewritten BNF will be unambiguous.
>
> Ok. Guess I have to google then for bnf rewriting.
> Thanks for your time.
>
>>
>> On Fri, Mar 6, 2015 at 11:50 AM, Andreas Kupries
>> <[email protected]> wrote:
>>> On Fri, Mar 6, 2015 at 11:33 AM, Jeffrey Kegler
>>> <[email protected]> wrote:
>>>> 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
>>>
>>> Thank you.
>>> It reminds me that I have not read perl code since Perl4.
>>> I believe it will take me a while to decipher that.
>>>
>>>> One thing to note is that it is *not* operator precedence -- the rule
>>>> have precedence, and the operators play no special role.
>>>
>>> So, in essence the rewrite generates an ambiguous grammar which the
>>> engine has no problems with, parsing them all in parallel, right ?
>>>
>>> And at the end the rule priorities are then used to collapse
>>> ambiguity, by keeping only the highest priority at each node ?!
>>>
>>> And I further guess that the only ambiguities which survive to the
>>> parse forest are those which have the same highest priority at a node.
>>>
>>>> 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 ?
>>>
>>>
>>>
>>> --
>>> Andreas Kupries
>>> Senior Tcl Developer
>>> Code to Cloud: Smarter, Safer, Fasterâ„¢
>>> F: 778.786.1133
>>> [email protected], http://www.activestate.com
>>> Learn about Stackato for Private PaaS: http://www.activestate.com/stackato
>>>
>>> --
>>> 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.
>
>
>
> --
> Andreas Kupries
> Senior Tcl Developer
> Code to Cloud: Smarter, Safer, Fasterâ„¢
> F: 778.786.1133
> [email protected], http://www.activestate.com
> Learn about Stackato for Private PaaS: http://www.activestate.com/stackato
>
> --
> 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.

Reply via email to