Re: How to write an SQL Interpreter/Compiler?

From: Jan Hidders <hidders_at_REMOVE.THIS.win.tue.nl>
Date: 8 Jan 2001 16:57:43 GMT
Message-ID: <93cri7$glu$1_at_news.tue.nl>


oliver Grampp wrote:
>
> i don't no where to ask my question. So i'm sorry if i'm wrong here.

Not really, but comp.databases.object is probably more appropriate since you are talking about something like an object-database. People there know what OQL is. :-)

By the way, please try to avoid HTML in postings. Some newsreaders have problems with that and it creates unneccessary overhead.

> i have written my own persistence tool in java. The objects can be
> stored in Files too.
> For searching and selecting Objects i want to use OQL. So i want to
> write an interpreter or compiler for that language that executes theses
> query statements on the pool of objects and returns the result.
>
> First of all i am not sure if i should write an interpreter or a
> compiler for the query language.

That depends on what you are going to use it for. If you are the only user and you programs only ask queries that are known at compile time, then you might consider writing a compiler. If, however, you want your users / programs to be able to ask ad hoc queries, then you probably need an interpreter.

> And second: how this thing should be designed.

Preferably with a parser generator. See for example:

  http://www.cs.princeton.edu/~appel/modern/java/CUP/

The syntax of OQL can be found at:

  http://wwwdb.inf.tu-dresden.de/lehre/DWB/skript.html

Writing a compiler/interpreter is not a trivial task. If you haven't done something like that before, then consider reading a little about compiler design.

-- 
  Jan Hidders
Received on Mon Jan 08 2001 - 17:57:43 CET

Original text of this message