[Versa] '-'

Uche Ogbuji uche.ogbuji at fourthought.com
Tue Sep 27 14:38:19 MDT 2005


On Tue, 2005-09-27 at 11:39 -0600, Michael Olson wrote:
> > We make the precedence rule explicit for this case, either using some
> > BisonGen feature (I'm not up to date on Bgen features), or by a simple
> > comment to warn people that the grammar is ordered that way for a
> > reason.
> >
> > More importantly, we should require parens in some ambiguous cases.   
> > The
> > essence of the problem is:
> >
> > $a - $b - $c -> *
> >
> > If you restrict the primary-expressions that are allowed as operands in
> > traversal expressions, you can eliminate this ambiguity.  In other
> > words, mandate parens and make the above illegal.  The user would have
> > to write:
> >
> > ($a - $b) - $c -> *
> >
> > or
> >
> > $a - ($b - $c) -> *
> >
> > or
> >
> > $a - ($b - $c -> *)
> >
> 
> I just wanted to add some thoughts to this that I have been finding as  
> I play with my 6 parser implementations.  Enforcing the above,   
> regardless of in docs or in the grammar has the negative side effect of
> 
> all() - ns:age -> . < 18
> 
> Now parsers as
> 
> (all() - ns:age -> . ) < 18
> 
> By giving the traversal operator a higher precedence to support
> 
> $x - $y - $x -> $a

Actually, I don't want to support that.  As I mentioned, I think we
should mandate parens for the above case.


-- 
Uche Ogbuji                               Fourthought, Inc.
http://uche.ogbuji.net                    http://fourthought.com
http://copia.ogbuji.net                   http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/



More information about the Versa mailing list