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

Re: Please make sure the grammar is directly machine consumable.

From: Tim Berners-Lee <timbl@w3.org>
Date: Fri, 19 Aug 2005 07:12:44 -0400
Message-Id: <73698BEA-52F3-48CB-B1C2-75FFC07CA745@w3.org>
Cc: public-rdf-dawg-comments@w3.org, Yosi Scharf <syosi@mit.edu>
To: Richard Newman <r.newman@reading.ac.uk>


I didn't realize the grammar in the spec is machine-generated.
Maybe it should be hand-edited and everything else
generated from it.

Yosi (on vacation right now) has generated (with a small hand tweak)
the CFG grammar in RDF from the spec.   (See sparql* in
)  This is in plain BNF (  cfg:mustBeOneSequence properties
with nested RDF collections )

See the bnf.n3 ontology in that directory as well as
the bnf-rules.n3 which go from some forms of ebnf to bnf,
also in that directory.


On Aug 18, 2005, at 16:26, Richard Newman wrote:

> As I recall from discussions with Andy Seaborne while I was  
> implementing twinql[1], the grammar in the SPARQL docs are directly  
> generated from a JavaCC grammar file. The source, therefore, is  
> machine-consumable -- at least, if you're using JavaCC!
> However, the output is not a particular friendly grammar to work  
> with -- optional dots after productions, for example, tripped up my  
> tool (so twinql makes them compulsory), and it took a bit of work  
> to get it into a usable state (as I detailed in a previous email[2]).
> -R
> [1] <http://www.holygoat.co.uk/projects/twinql/>
> [2] <http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/ 
> 2005Aug/0055.html>
> On 18 Aug 2005, at 11:28, Tim Berners-Lee wrote:
>> This is a followup from a discussion between Yosi Scharf,  
>> implementer of SPARQL in cwm, currently on vacation,  and Eric  
>> P'dH, co-editor of the spec, several weeks ago.
>> Yosi has built his implementation of SPARQL from a file which is  
>> almost the one generated from the TR, but with a slight tweak to  
>> make the file grammar able to be parsed by a predictive parser [1]  
>> a simple form of LL(1) recursive descent parser.  I understood  
>> that the tweak was editorial in that the it didn't change the  
>> language, just the way it was expressed as a context-free grammar.
>> A situation in which code can be generated directly from the spec  
>> is a very strong position to be in.  I am not aware of any time  
>> this has previously happened for a W3C language, but I may be  
>> wrong.  As it is demonstrably simple to make the step here I would  
>> request it be done at last call stage before the call for  
>> implementation at CR.
>> [1] http://www.inf.ed.ac.uk/teaching/courses/cs2/LectureNotes/ 
>> CS2Ah/LangProc/lp10.pdf
>> Tim Berners-Lee
Received on Friday, 19 August 2005 11:12:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:01:21 UTC