[Versa] '-'

Michael Olson Mike.Olson at fourthought.com
Mon Sep 26 14:54:37 MDT 2005


Just an update,  I've implemented enough of "precedence" that I can  
produce a .y file with precedence support.

Its not helping.

Given the current grammar, here is a bit of output from bison (not  
bgen) where the reduce reduce conflict is happening.

"""
state 42

     primary_expression  ->  resource_expression .   (rule 77)
     arc_start_expression  ->  resource_expression .   (rule 113)

     DASH	reduce using rule 77 (primary_expression)
     DASH	[reduce using rule 113 (arc_start_expression)]
     PIPE_DASH	reduce using rule 113 (arc_start_expression)
     $default	reduce using rule 77 (primary_expression)

"""

Which basically says (for those not familiar with bison)

Given a resource_expression, if the look ahead is a DASH, then either  
reduce it to primary_expression, or reduce it to arc_start_expression.

primary_expression being the road to subtraction, and  
arc_start_expression leads us to a traversal.

As the grammar currently stands (with single '-')

all() - rdf:type -> *

will not parse because "all() - rdf:type" will reduce to a primary  
expression and then "primary-expression -> expression" is invalid.

However, all 15 other forms of traversal/filter will parse (15  
including the fwd, bwd, and exitensial)

ideas?

The solutions I currently see as possible are
a)  double dash so all() -- rdf:type -> *
b)  a new symbol for subtraction.  XPath did it with "div" I assume  
because of the same problems with the "/" path operator.  We could do  
"sub"
c)  A symbol to start a traversal, something like # all() - rdf:type ->  
*
d) Reorder the bgen file so that the arc-start-expression always  
reduces first and live with the error.

IMO

a) +2
b) +1
c) -1
d) -10

I'm very opposed to "d" because down the road, someone may try to clean  
up the grammar and all of the sudden everything breaks for no reason.

Mike

------------------------------------------------------------------------ 
-----------------
Mike Olson                                                Principal  
Consultant
mike.olson at fourthought.com                +1 720 253 4662
Fourthought, Inc.                                       
http://Fourthought.com
PO Box 270590,                                       http://4Suite.org
Louisville, CO 80027-5009, USA
XML strategy, XML tools, knowledge management



More information about the Versa mailing list