Re: yacker grammar

Hi Eric,

On 19/10/10 04:21, Eric Prud'hommeaux wrote:
> I updated the
>    http://www.w3.org/2005/01/yacker/uploads/SPARQL_11?lang=perl
> yacker grammar to reflect
>    http://www.w3.org/2009/sparql/docs/sparql-grammar-11
> with three small changes:
>
> Added a "top" to put all of SPARQL under one start production:
> + [0]	Top 	  ::=   	QueryUnit | UpdateUnit

That is ambiguous in an LL(1) grammar (both start Prologue) - there was 
a comment about this a while ago.


>
> Moved the WS*s out of 36-38 and split 39 to avoid the reduce-reuse-recyle error:
> ~ [36]	InsertData 	  ::=   	'INSERT' 'DATA' QuadData
> ~ [37]	DeleteData 	  ::=   	'DELETE' 'DATA' QuadData
> ~ [38]	DeleteWhere 	  ::=   	'DELETE' 'WHERE' QuadPattern # ???

Fixed.

> ~ [39]	Modify 	  ::=   		( DeleteClause InsertClause? | InsertClause ) UsingClause* 'WHERE' GroupGraphPattern
> ~ | ( 'WITH' IRIref ) ( DeleteClause InsertClause? | InsertClause ) UsingClause* 'WHERE' GroupGraphPattern

Is there a way to write this without the duplication?

Modify ::= ( 'WITH' IRIref )? Modify2
Modify2 ::= ( DeleteClause InsertClause? | InsertClause ) UsingClause* 
'WHERE' GroupGraphPattern

>
> Why do we need QuadData and QuadPattern?
> ~ [46]	QuadData 	  ::=   	'{' Quads '}' # ???

Because QuadData can't have variables in it, but QuadPattern can.

Rather than writing out the triples+GRAPH rules twice, once for with 
variable and once for without (which wouldn't work in LALR(1) anyway), 
the grammar uses different names for these two cases so there is 
something to hang some (unwritten) text notes from.

>
> Removing DeleteWhere and s/QuadPattern/QuadData/g gives no S/R errors.
>

Thanks for the comments - if you could let me know about [39] for LALR, 
that would be great.
	Andy

Received on Tuesday, 19 October 2010 07:47:15 UTC