|with or without keywords firstname.lastname@example.org (Buday Gergely) (1998-03-12)|
|Re: with or without keywords email@example.com (Vladimir Alexiev) (1998-03-15)|
|Re: with or without keywords firstname.lastname@example.org (1998-03-18)|
|Re: with or without keywords Nick.Roberts@dial.pipex.com (Nick Roberts) (1998-03-18)|
|Re: with or without keywords email@example.com (Olaf Stoyke) (1998-03-18)|
|From:||firstname.lastname@example.org (Scott Amspoker)|
|Date:||18 Mar 1998 23:00:08 -0500|
Buday Gergely <email@example.com> wrote:
>I'd like to parse a language that allows embedded sql querys. The
>problem is that tokens that are keywords in an sql statement are
>allowed as an identifier outside it.
It gets worse. SQL itself has problems with keywords and "legitimate"
field/table names. I use quotes because there are some legacy
database products that allow all kinds of garbage as identifiers.
Whether or not standard SQL allows it, you should brace yourself for
them. One example is the DESC keyword (short for DESCENDING).
Although it is "reserved", it's not unusual to encounter it as a field
name (short for DESCRIPTION). Another example is 'BY' which is
reserved but only shows up after another keyword ("GROUP BY", "ORDER
BY"). One database product allowed field names to contain a '-':
SELECT CUST-NAME FROM CUSTFILE
You can imagine the problems with the above statement. Let me repeat, this
is *not* called for by SQL but will show up in the real world.
Once you figure out how to keep the embedded SQL separate from the rest of
your grammer (other posts in this thread have suggested ways to do that),
then you must deal with SQL itself. Try to be as liberal as possible with
reserved words. It will save you headaches later.
Return to the
Search the comp.compilers archives again.