[comp.databases] WANTED -- SQL grammar

kamens@Neon.Stanford.EDU (Samuel N Kamens) (05/28/90)

I am doing a project in Sybase SQL, and it looks like I'll have to write 
a preprocessor.  I'd like to do it by parsing the input using yacc.

However, I don't have a copy of a yacc grammar for SQL, and I'd rather not
spend lots of time writing one.  Does anyone have a yacc-type grammar
for SQL? I don't need any actual actions, just the "bare" form into 
which I can put my own actions.  If you don't have a sybase version,
anything will do.

Thanks in advance,


-- 
Sam Kamens		     |  "What is the air speed velocity of an unladen
kamens@neon.stanford.edu     |   swallow?"

bapat@rm1.UUCP (Bapat) (05/31/90)

In article <1990May27.230851.11245@Neon.Stanford.EDU>, kamens@Neon.Stanford.EDU (Samuel N Kamens) writes:
> 
> I am doing a project in Sybase SQL, and it looks like I'll have to write 
> a preprocessor.  I'd like to do it by parsing the input using yacc.
> 
> However, I don't have a copy of a yacc grammar for SQL, and I'd rather not
> spend lots of time writing one.  Does anyone have a yacc-type grammar
> for SQL? 
> -- 
> Sam Kamens		     |  "What is the air speed velocity of an unladen
> kamens@neon.stanford.edu     |   swallow?"


For a quick-and-dirty example of a yacc grammar of SQL (not the full X3H2 
standard but mostly exemplifying clauses for SELECT), look up the article 

   "Rapid Implementation of SQL: A Case Study using Yacc and Lex"

by Kaizad B. Heerjee and Rubik Sadeghi, which appeared in "Information and
Software Technology", Vol 30 No 4, May 1988, pages 228-236.

The complete BNF is available in the IBM J. Res. Development, November 1976,
pp 560-575. The ANSI standards documents also contain a formal description
of the grammar - not sure whether it's BNF.
-- 
Subodh Bapat              bapat@rm1.uu.net     OR           ...uunet!rm1!bapat
MS E-204, P.O.Box 407044, Racal-Milgo, Ft Lauderdale, FL 33340  (305) 846-6068

"In the great journey of life, I seem to have lost my boarding pass."

john@newave.UUCP (John A. Weeks III) (06/02/90)

In article <1990May27.230851.11245@Neon.Stanford.EDU> kamens@Neon.Stanford.EDU (Samuel N Kamens) writes:
>I am doing a project in Sybase SQL, and it looks like I'll have to write 
>a preprocessor.  I'd like to do it by parsing the input using yacc.

One was posted a while back.  If you cannot find it in the archives, please
drop me an E-Mail.  I have it on a tape somewhere.

-john-

-- 
===============================================================================
John A. Weeks III               (612) 942-6969               john@newave.mn.org
NeWave Communications                ...uunet!rosevax!bungia!wd0gol!newave!john
===============================================================================