Groups | Search | Server Info | Login | Register


Groups > comp.databases > #103

OS-SQL-Grammar?

From Norbert_Paul <norbertpauls_spambin@yahoo.com>
Newsgroups de.comp.datenbanken.misc, comp.databases, comp.databases.theory
Subject OS-SQL-Grammar?
Date 2011-07-07 09:32 +0200
Organization A noiseless patient Spider
Message-ID <iv3nf4$jbv$2@dont-email.me> (permalink)

Cross-posted to 3 groups.

Show all headers | View raw


Hi,

is there a handy (and parseable) Open Source SQL-grammar around,
that can be fed into a parser generator without major problems?
I consider ISO 9075:2003 useless for this purpose and don't get
the point of this "standard".

I have (many) problems with the ISO grammar.
Here is one I spotted yesterday: Is the following string

    "/* this is */ a strange comment */"

a valid SQL-Comment (according to SQL 2003)?
I think I have to say (reluctantly) yes:

Proof
Excerpts from ISO 9075-2:2003 (with rule numbers attached):

<comment> ::=
     <simple comment>
   | <bracketed comment>                           (1)

<bracketed comment> ::=
     <bracketed comment introducer>                (2)
     <bracketed comment contents>
     <bracketed comment terminator>

<bracketed comment introducer> ::= /*             (3)

<bracketed comment terminator> ::= */             (4)

<bracketed comment contents> ::=
     !! See the Syntax Rules
     [ { <comment character> | <separator> }... ]  (5)

<comment character> ::=
     <nonquote character>                          (6)
   | <quote>

<nonquote character> ::= !! See the Syntax Rules. (7)

<solidus> ::= /                                   (8)

<asterisk> ::= *                                  (9)


Syntax rules: to (5) and (7)
10) Within a <bracketed comment contents>, any <solidus> immediately followed by an <asterisk> without
     any intervening <separator> shall be considered to be the <bracketed comment introducer> of a <separator>
     that is a <bracketed comment>.

11) A <nonquote character> is one of:
     a) Any character of the source language character set other than a <quote>.
     b) Any character other than a <quote> in the character set identified by the <character set specification>
        or implied by “N”.

Derivation:
<comment>
   --> <bracketed comment>                             (1)
   --> <bracketed comment introducer>                  (2)
       <bracketed comment contents>
       <bracketed comment terminator>
   --> "/*"                                            (3,4,5)
       [ { <comment character> | <separator> }... ]
       "*/"
   --> "/*"                                            (6) und Syntax rules 10 und 11.
       " this is */ a strange comment "
       "*/"
   --> "/* this is */ a strange comment */"
                    ^
                     This <solidus> is not immediately followed by an <asterisk>
                     and it is a <nonquote-character>, too.

Did I (or the authors ouff this _standard_ (n.b.)) miss something I should have norticed?

Norbert

Back to comp.databases | Previous | NextNext in thread | Find similar


Thread

OS-SQL-Grammar? Norbert_Paul <norbertpauls_spambin@yahoo.com> - 2011-07-07 09:32 +0200
  Re: OS-SQL-Grammar? Nessi <nessi@nefkom.info> - 2011-07-07 09:54 +0200
  Re: OS-SQL-Grammar? Dieter Nöth <dnoeth@gmx.de> - 2011-07-07 10:04 +0200

csiph-web