I'm surprised nobody has mentioned John Aycock's SPARK library. This allows you to define your grammar tokens as a class, and the grammar productions in the class doc strings. It was designed specifically for the development of custom/little languages. You may find it at: http://www.csr.uvic.ca/~aycock/python/ Hope this helps. -Jon