Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!mailrus!uflorida!novavax!rm1!bapat From: bapat@rm1.UUCP (Bapat) Newsgroups: comp.databases Subject: Re: WANTED -- SQL grammar (preferably for sybase) Keywords: yacc, SQL grammar Message-ID: <868@rm1.UUCP> Date: 31 May 90 14:04:06 GMT References: <1990May27.230851.11245@Neon.Stanford.EDU> Organization: the boundary between UNIX and sanity Lines: 29 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."