Sean,
I did the same using pyparsing recently - I found pyparsing quite 
pythonic and *very* easy to use. The definition of the grammar looks 
something like this:

    ...
    word = Word(wordstartchars, wordchars)
    phrase = QuotedString('"''')
    term = Optional(uoper) + (phrase | word)
    ...
    group_or_term = group | term
    terms = OneOrMore(Optional(oper) + group_or_term)
    ...

I can send you the full code if you want.

- Frank

Shannon -jj Behrens wrote:
> On 1/26/07, Sean Davis <[EMAIL PROTECTED]> wrote:
>   
>> I would like to build a small app akin to a filemaker database, but
>> web-based, of course.  One nice feature of filemaker is the ability to
>> search based on pretty much any field (or combination).  I know how to do
>> the searches, but I would like to make a simple query language (things like
>> "2..3", ">3", "=3", "widge*", etc.).  I have read a bit about tokenizers.
>> Does using a token system make sense, or is there a better or simpler way?
>> Of course, I have to validate these things and then create SQL from them, so
>> any hints from that point of view are also appreciated.
>>     
>
> I did something very similar to this recently.  I implemented search
> expressions like "food and (cheese or beer)" and translated the
> expressions into SQL.  I made use of Yapps2.  I've used PLY in the
> past.  I liked both of them.  I can send you code if you want.
>
> In the distant past, I wrote an article about writing a programming
> language in Python:
> http://www.ddj.com/184405580;jsessionid=NZM4QI22OXGR4QSNDLRSKHSCJUNN2JVN?_requestid=578822
>
> Happy Hacking!
> -jj
>
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to