e_bachmann has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to parse CCL commands like:
I need to seach a database for each token and combine the results.dylan "bob dylan" dylan or zimmerman bob and (dylan or zimmerman)
- What the best approach for this task?
- I've been looking at a lot of parsers, but can't find anything similar.
- I've found a grammar for such a comman, but failed to build any perl code from this
:-) Erik Bachmann
CCL-Find ::= CCL-Find Op Elements | Elements. Op ::= "and" | "or" | "not" -- The above means that Elements are separated by boolean operators. Elements ::= '(' CCL-Find ')' | Set | Terms | Qualifiers Relation Terms | Qualifiers Relation '(' CCL-Find ')' | Qualifiers '=' string '-' string -- Elements is either a recursive definition, a result set reference +, a -- list of terms, qualifiers followed by terms, qualifiers followed -- by a recursive definition or qualifiers in a range (lower - upper +). Set ::= 'set' = string -- Reference to a result set Terms ::= Terms Prox Term | Term -- Proximity of terms. Term ::= Term string | string -- This basically means that a term may include a blank Qualifiers ::= Qualifiers ',' string | string -- Qualifiers is a list of strings separated by comma Relation ::= '=' | '>=' | '<=' | '<>' | '>' | '<' -- Relational operators. This really doesn't follow the ISO8777 -- standard. Prox ::= '%' | '!' -- Proximity operator