Paul McGuire wrote: > (sorry if this is a double-post - I tried posting this last night but I > think GoogleGroups ate it) > > Pyparsing is a pure-Python class library for quickly and easily > constructing recursive-descent parsers. Pyparsing takes a > "building-block" approach to parser construction, as opposed to code > generation methods (such as lex/yacc) or pattern definition strings > (such as regular expressions).
Funnily enough, I've been thinking about something exactly like this. I've realized that my desired scripting language for the mud client I'm writing is very much a CFG, so simple regexes aren't going to cut it. The biggest issue for me is command syntax -- commands can have one of a number of parameter formats (number and type of parameters can vary). With a special command-marker at the beginning of the expression, I know unambiguously what is a command and what is not, but I'd need to look up in a dictionary (indexed by command name) the types. Is the pyparsing tokenizer flexible enough to let me do this sort of thing easily? -- http://mail.python.org/mailman/listinfo/python-list