W3C home > Mailing lists > Public > public-rdf-comments@w3.org > August 2011

Turtle grammar issues

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Thu, 18 Aug 2011 20:40:58 -0400
To: "public-rdf-comments@w3.org" <public-rdf-comments@w3.org>
Message-ID: <490BDA3C-B7B3-4D4C-8708-143E345A22A7@greggkellogg.net>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:59:29 UTC