Related articles |
---|
Devising a grammar for boolean queries lomise@uta.fi (Bemmu Sepponen) (2000-10-31) |
Re: Devising a grammar for boolean queries nailed_barnacleSPAMFREE@hotmail.com (2000-11-01) |
Re: Devising a grammar for boolean queries joachim_d@gmx.de (Joachim Durchholz) (2000-11-01) |
Re: Devising a grammar for boolean queries rhyde@cs.ucr.edu (Randall Hyde) (2000-11-01) |
From: | Randall Hyde <rhyde@cs.ucr.edu> |
Newsgroups: | comp.compilers |
Date: | 1 Nov 2000 18:51:23 -0500 |
Organization: | Posted via Supernews, http://www.supernews.com |
References: | 00-10-226 |
Keywords: | parse |
Posted-Date: | 01 Nov 2000 18:51:23 EST |
Bemmu Sepponen at lomise@uta.fi wrote on 10/31/00 12:37 PM:
> I assume the precedence of "and" and "or" is the same (true?).
Depends on your system. Most programming languages actually give
AND a higher precedence than OR. (well, most programming languages
I know, anyway).
> query -> phrase | phrase operator query
> operator -> and | or
> phrase -> word | word phrase
>
> Am I even close? How about the parentheses?
Almost any compiler text, which you should definitely take a look at,
will discuss expression grammars. For something as simple as the above
(ignoring parentheses) you can can use a regular expression:
query: phrase ( operator phrase )*
Of course, if you want precedence *and* nested expressions (parentheses)
then you will need a grammar. The exact grammar you should use depends
on how (and if) you intend to implement the grammar. For that, see
a compiler text.
Randy Hyde
Return to the
comp.compilers page.
Search the
comp.compilers archives again.