|Devising a grammar for boolean queries email@example.com (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 firstname.lastname@example.org (Joachim Durchholz) (2000-11-01)|
|Re: Devising a grammar for boolean queries email@example.com (Randall Hyde) (2000-11-01)|
|From:||Randall Hyde <firstname.lastname@example.org>|
|Date:||1 Nov 2000 18:51:23 -0500|
|Organization:||Posted via Supernews, http://www.supernews.com|
|Posted-Date:||01 Nov 2000 18:51:23 EST|
Bemmu Sepponen at email@example.com 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.
Return to the
Search the comp.compilers archives again.