On Friday, Jun 13, 2003 Richard Jelinek said:

> On Fri, Jun 13, 2003 at 11:24:05AM -0700, Ron D. Smith wrote:
> > Ordering is how you establish priority in ambiguous situations.  If you turn 
> 
> This is an interesting aspect/information.
> 
> >       proplist:    property xorand_prop(s?)
> > 
> >       xorand_prop: xor_prop|and_prop
> >       xor_prop:    '|' property
> >       and_prop:    ',' property
> 
> Actually this does also:
> 
>       proplist:    property xor_prop(s)
>                  | property and_prop(s?)

You pointed out the actual ambiguity of your grammar.  Since you were 
allowing for zero or more xor_props, it was "satisfied" when it got to the 
comma (or vice versa).

Again, my point still holds that the problem has nothing to do with the order 
per se, P::RD did exactly what you told it to do.

Try the $::RD_TRACE debug feature.  In the future, I'm sure you will find it 
extremely helpful.  It both points out the problems with a grammar definition 
as well as helps you understand what to do to optimize an implementation.

> 
> without the xorand rule. And now I understand this construct and why
> it does work. But this doesn't change anything it just pushes the
> problem one step further.
> 
> You say, ordering is to establish priority in ambiguous
> situations. Well - given this rule:
> 
> (I)
> 
> order_sensitive:    phrase
>                 | phrase '(' blah ')'
> 
> Ambiguity? Yes. But this NEVER gets to the second production. While
> 
> (II)
> 
> order_sensitive:    phrase '(' blah ')'
>                 | phrase 

This is both efficient as well as unambiguous:

Insensitive_With_Optional_Tail: phrase tail(?)

tail: '(' blah ')'


> 
> parses all well, I really don't have a choice to set priority with
> ordering. Probably my input has more non-parameter phrases than those
> with parameters. No matter what, I have to use the inefficient (II).
> With my present knowledge - that is.
> 
> -- 
> best regards,
> 
>      Dipl.-Inf. Richard Jelinek
> 
>      - The PetaMem Group - Prague/Nuremberg - www.petamem.com -
>                      -= 2325182 Mind Units =-

--
 Intel, Corp.
 5000 W. Chandler Blvd.
 Chandler, AZ 85226

-- 
 Intel, Corp.
 5000 W. Chandler Blvd.
 Chandler, AZ  85226


Reply via email to