[sugar] Education?
Simon Forman
forman.simon at gmail.com
Sat Mar 17 01:30:57 EDT 2007
On 3/11/07, Guido van Rossum <guido at python.org> wrote:
> On 3/11/07, Andrew Clunis <orospakr at linux.ca> wrote:
> > Antoine van Gelder wrote:
> > > Don Hopkins wrote:
> > >> Of course it might just be more powerful and efficient to re-implement
> > >> something like Klik-and-Play from scratch in Python, as a plug-in
> > >> visual scripting component, which can be used to script a
> > >> HyperCard-like gui environment, and games built on top of it like
> > >> SimCity and Robot Odyssey.
> > >
> > > Anyone know the current status of being able to turn an AST tree emitted
> > > by the Python compiler module back into code after it has been modified ?
> >
> > I've been looking into this for Develop activity, but it seems that path
> > has never been explored. Best approach seems to be to write a
> > pretty-printer to walk the tree.
>
> I'm curious about the focus on ASTs that seems apparent in this
> subthread (though I may easily be misreading between the lines :-).
> I've always been more inclined to edit the text and re-parse from
> there, as it puts the author in control of formatting, comments etc.,
> and this is how most "real-world" environments work. (Not that that
> necessarily makes it better, but neither is the opposite true.) Is
> someone willing to write up a brief comparison between the two
> approaches?
>
This isn't really a comparison, but briefly,
AST vs. source code
* constraining the data to be at least valid, syntactically correct
trees rather than ASCII chars in a row removes a major source of bugs.
* more amiable to direct manipulation via GUIs.
* can be elaborated w/o clutter vs. comments and annotations in text
which must be made to fit (function-annotations discussion on py3k
list)
* I18N
* compression.
* pre-processed for other tools, lint, translators, doc generators, verifiers
More important than AST vs. char[] is maintaining the ease of
inter-conversion of the two. The policy on python's grammar is a good
example of this principal.
Peace,
~Simon
More information about the Sugar
mailing list