Print

Print


Matthias Hess writes:
 > I am currently implementing a CQL Parser for .NET / C#. When I studied 
 > the BNF in the CQL spec, I found something which does not make sense to 
 > me. The spec says:
 > 
 > term  ::=  identifier | 'and' | 'or' | 'not' | 'prox' | 'sortby' 
 > 
 > this means that the words and, or, not, prox and sortby are valid terms.
 > 
 > The spec also says that
 > 
 > prefix, uri, modifierName, modifierValue, searchTerm, index  ::=  term 
 > 
 > this means that the words and, or, not, prox and sortby are valid as 
 > prefix, uri, modifierName, modifierValue, searchTerm and index.
 > 
 > Putting all this together, it means that the following strings are all 
 > valid CQL Queries:
 > 
 > and
 > 
 > and and and
 > 
 > and or not and or not and dino and not not and

Sadly, yes.

 > Is this an error in the CQL spec?

In my opinion, yes; but that is an aesthetic judgement rather than an
engineering one.  The grammar does correctly describe the language as
the committee decided (not unanimously :-) it should be.

 _/|_	 ___________________________________________________________________
/o ) \/  Mike Taylor    <[log in to unmask]>    http://www.miketaylor.org.uk
)_v__/\  "Though they may not understand all the words, all the same they
	 hear the music" -- Steven Sondheim, "Another National Anthem"