[Python-ideas] Needing help to change the grammar

Carl Johnson cmjohnson.mailinglist at gmail.com
Tue Apr 21 05:20:04 CEST 2009

Stephen J. Turnbull wrote:
> Terry Reedy writes:
>  > spir wrote:
>  > > Why not simply have a preprocessing func that translates back to
>  > > standard/english python using a simple dict?
> Because it's just not that simple, of course.  You need to parse far
> enough to recognize strings, for example, and leave them alone.  Since
> the parser doesn't detect unbalanced quotation marks in comments, you
> need to parse those too.  You must parse import statements, because
> the file name might happen to be the equivalent of a keyword, and
> *not* translate those.  There may be other issues, as well.

Would it be possible to use 2to3 for this? It wouldn't be perfect but
it might be easier to scale a preprocessor to dozens of languages
without freezing those users out of the ability to use standard
English Python modules.

Also, does anyone know if ChinesePython [1] ever caught on? (Hey,
there's one case where you do NOT need to worry about keyword
conflicts!) Looking at the homepage, it appears stuck at Python 2.1.
But I don't know much Chinese, so I could be wrong.

[1]: http://www.chinesepython.org/cgi_bin/cgb.cgi/english/english.html


-- Carl

More information about the Python-ideas mailing list