[Python-Dev] Java-ing Python /2 (original) (raw)

Greg Ewing greg@cosc.canterbury.ac.nz
Fri, 12 Apr 2002 12:12:18 +1200 (NZST)


Still, in my opinion it would be quite an interesting feature if python could make the addition of other grammars as easily as adding a new python module.

I believe there is an intention to re-design the parsing stuff at some time in the future to make the parse tree more easily accessible and manipulable, so maybe something like this will be possible one day.

A new grammar module would basically be a map of the foreign language to the python tokens.

There's always going to be more to doing such a translation than just token-to-token mappings -- otherwise it would be possible to turn Java into Python with a few simple string substitutions. :-)

And a mechanism to deal with non-mappable features of the foreign language.

Yep, that's the really hard part!

Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+