Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 30BEC9FA342 for ; Tue, 7 Nov 2006 08:32:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 24318-07 for ; Tue, 7 Nov 2006 08:32:07 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) by postgresql.org (Postfix) with ESMTP id CD9909F944D for ; Tue, 7 Nov 2006 08:32:06 -0400 (AST) Received: by ug-out-1314.google.com with SMTP id k3so1006842ugf for ; Tue, 07 Nov 2006 04:32:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CSFH1m1AYi5IBsfYARVGOumejJxuIEVn08Ub84Enq3vG+8ztA2xNyEfUJj19GyR2tKR9lpFN0B6cXykPk4BfyBP4n2UM0aHV1YOMGdICnY4riqWaIg2tf0PUPJuS/hkkeSUy2Rpfm+gObbAF4pXBZ4cq/abCwoxoYypybEH4F8g= Received: by 10.78.41.3 with SMTP id o3mr4820981huo.1162902724455; Tue, 07 Nov 2006 04:32:04 -0800 (PST) Received: by 10.78.165.7 with HTTP; Tue, 7 Nov 2006 04:32:03 -0800 (PST) Message-ID: <36e682920611070432ke5d17d3m26be8036e6c6d033@mail.gmail.com> Date: Tue, 7 Nov 2006 07:32:03 -0500 From: "Jonah H. Harris" To: "Peter Michaux" Subject: Re: writing a simple sql parser and database program Cc: pgsql-sql@postgresql.org In-Reply-To: <3cbaf1c80611062302q7d07a661qc4c3eb3e89105572@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3cbaf1c80611062302q7d07a661qc4c3eb3e89105572@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/98 X-Sequence-Number: 26750 On 11/7/06, Peter Michaux wrote: > I would like to learn how to write a simple SQL parser and database > program ... Is there a link or book that explains the basics of how a > database parses SQL and how it then operates on the data? For a fairly good learning resource, you can check out LEAP (http://leap.sourceforge.net/); it doesn't use SQL and instead, has it's own relational language... but it's a good place to start if you want to learn how this stuff works. You can also check out pql (http://www.ibiblio.org/pub/Linux/apps/database/sql/pql-0.8.1.src+bin.tgz), which uses a SQL-ish language, or SQLite for a little more advanced example (http://www.sqlite.org) Of course, there's a lot of fairly simple and easy-to-understand Java databases like hsql or McKoi too. Most Java databases are going to be using ANLTR or JavaCC for their parsers while C/C++-based databases use Bison, ANTLR/PCCTS, or a hand-written SQL parser. A Java database is going to be a lot easier to understand the concepts of than one in C. -- Jonah H. Harris, Software Architect | phone: 732.331.1300 EnterpriseDB Corporation | fax: 732.331.1301 33 Wood Ave S, 2nd Floor | jharris@enterprisedb.com Iselin, New Jersey 08830 | http://www.enterprisedb.com/