Looking back, I see that I addressed the relationship between precedence and ambiguity in the docs: https://metacpan.org/pod/distribution/Marpa-R2/pod/Scanless/DSL.pod#Precedence-and-ambiguous-grammars
On Fri, Sep 2, 2016 at 1:49 PM, Anton Dyudin <[email protected]> wrote: > It seems clear to me that > > option ::= opt1a || opt2a > opt1a ::= 'a' > opt2a ::= 'a' 'a' > > doesn't want ambiguity; but that the BNF rewrite does introduce it, by > treating the || as an ambiguous option. Or is it supposed to be precedenced > only in recursive contexts? > > On Friday, 2 September 2016, Jeffrey Kegler <[email protected] > om> wrote: > >> If you *want* ambiguity, consider avoiding the precedenced rule syntax >> and writing it directly in BNF. Precedenced rules are intended to cover >> the ordinary cases. If you're doing advanced and tricky stuff, laying it >> out in pure BNF forces you to make it clear exactly what you meant. >> >> I find that many systems, with their advanced features and syntaxes, go >> too far in the DWIMery. This is handy if their "Do What I Mean" is in fact >> what you meant. But if the DWIMery guesses wrong, the system just makes >> things more complicated. So I try to not make my advanced features *too* >> smart. >> >> On Thu, Sep 1, 2016 at 11:48 AM, <[email protected]> wrote: >> >>> Thanks for the pointer to prose on the rule rewriting. I can read Perl >>> about as well as middle English -- lots of effort and guessing, and usually >>> getting pretty close. :-) >>> >>> Further comments inline below. >>> >>> On Wednesday, August 31, 2016 at 10:10:01 PM UTC-6, Jeffrey Kegler wrote: >>> >>>> Just in case it was unclear, that last message was aimed at the general >>>> reader of this read, and was not ad hominem. >>>> >>> >>> No offense taken -- it sounds like great advice to me in particular! >>> >>> @Anton: Off the top of my head, 2+3+4 is ambiguous in that grammar -- >>>> the BNF does not implement associativity. >>>> >>> >>> So SLIF has an implied, default associativity? I can find one IRC >>> comment to this effect, but I can't find it anywhere in the docs. (There's >>> a great potential spot in Scanless/DSL.pod where it discusses >>> associativity....) >>> >>> This explains why my parse was not ambiguous. What if I *want* my >>> grammar to be ambiguous in this case? I saw another IRC comment asking for >>> an adverb setting for associativity of "none". Is this possible? >>> >>> Thanks! >>> >>> - Ryan >>> >>> <snip> >>> >>> -- >>> 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. >> > -- > 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.
