W3C home > Mailing lists > Public > public-rdf-wg@w3.org > December 2012

Re: Left-recursive LALR(1) grammar for turtle (ACTION-217)

From: David Wood <david@3roundstones.com>
Date: Mon, 10 Dec 2012 06:52:49 -0500
Message-Id: <7A98ADC0-3CE9-4B0E-ACBE-478FDD4F487E@3roundstones.com>
Cc: "public-rdf-wg@w3.org" <public-rdf-wg@w3.org>
To: Andy Seaborne <andy.seaborne@epimorphics.com>
Hi Andy,

I presume you mean a "note" in the Turtle spec and not a "WG Note".  If so, I like your suggestion.

Regards,
Dave


On Dec 10, 2012, at 5:51, Andy Seaborne <andy.seaborne@epimorphics.com> wrote:

> The issue raised is wanting to add to the useablity of grammar for LALR parser generators.  Object lists do not have this problem because comma is a separator, and you can't have a trailing ",".
> 
> As this useability rewrite is at odds with a grammar for top down (RC or LL) usage, we can't have both.
> 
> Suggestion:
> 
> Publish the grammar as it is in the LC version (which is the same as SPARQL 1.0) and also add a note for this rule that explains a way an LALR generator might be applied, quoting the rule below, aligned in names to the published grammar.
> 
> On 08/12/12 15:53, Sandro Hawke wrote:
>> polist
>>     : predicate olist
>>     | polist SEMI
>>     | polist SEMI predicate olist
>>     ;
> 
> We should note this a an expected shift/reduce conflict.  See section 5.2 [1] of the bison manual for how that's hanlded in this rather common case.  By default it does one token lookahead (AKA it behaves like an LL parser!).
> 
>    Andy
> 
> [1] http://www.gnu.org/software/bison/manual/bison.html#Shift_002fReduce
> 
Received on Monday, 10 December 2012 11:48:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:53 GMT