Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!sdd.hp.com!elroy.jpl.nasa.gov!ames!haven.umd.edu!mimsy!kong!njacobs From: njacobs@kong.gsfc.nasa.gov (Nick Jacobs - EOS) Newsgroups: comp.databases Subject: Re: SQL grammar Keywords: yacc Message-ID: <1991May31.112655.27947@kong.gsfc.nasa.gov> Date: 31 May 91 11:26:55 GMT References: <6040@goanna.cs.rmit.oz.au> Followup-To: comp.databases Organization: Goddard Space Flight Center Lines: 21 In article <6040@goanna.cs.rmit.oz.au> djds@goanna.cs.rmit.oz.au (DARYL JOHN D'SOUZA) writes: >Has anyone got a SQL grammar definition suitable for yacc? It is for [ ... ] >Daryl D'Souza Actually, you can pretty much feed the definitions in the ANSI standard straight into yacc. The notation changes are mostly so trivial you can apply them as you're typing it in, e.g. ::= WHERE -- ANSI X3.135-1989 becomes where_clause | WHERE search_condition ; -- yacc You need to add a grammar rule for each list, and rules for option keywords, all straightforward. I recently built a parser for SQL query specifications using yacc, email me if you want more details. Nick Jacobs