Turtle grammar issues

I'm having some issues with the Turtle grammar [1], that may be my own or a misunderstanding, but I wanted to raise them:

Grammar production [7] seems to have a conflict

[7] predicateObjectList ::= verb objectList ( ";" verb objectList )* (";")?

I'm running into problems with statements such as the following:

:a :b :c ; .

This is because ';' is a first for both ( ";" verb objectList )* and (";")? The parser sees the ";" and starts down the verb objectList path only to find a ".", for which it fails. It would seem to require a look ahead, which would mean it is not an LL(1) grammar. SPARQL constructs this somewhat differently:

[72]   PropertyListNotEmpty ::=   Verb ObjectList ( ';' ( Verb ObjectList )? )*

The equivalent for turtle might be:

[7] predicateObjectList ::= verb objectList ( ";" ( Verb ObjectList)? )*

I'm not sure this would do it, but I might try it in on my own.

Gregg (Not a compiler expert) Kellogg

[1] http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/turtle.bnf

Received on Friday, 19 August 2011 00:41:46 UTC