Which Python tool can you recommend to parse programming languages? It should allow for a readable representation of the language grammar inside the source, and it should be abl
For a more complicated parser I would use pyparsing. Pyparsing
Here is the parsed example from there home page
from pyparsing import Word, alphas
greet = Word(alphas) + "," + Word(alphas) + "!" # <-- grammar
defined here
hello = "Hello, World!"
print(hello, "->", greet.parseString(hello))
For simple task I tend to use the shlex module.
See http://wiki.python.org/moin/LanguageParsing for evaluation of language parsing in python.
Antlr generates LL(*) parsers. That can be good, but sometimes removing all left recursion can be cumbersome.
If you are LALR(1)-savvy, you can use PyBison. It has similar syntax to Yacc, if you know what it is. Plus, there are a lot of people out there that know how yacc works.