Compiler, was Re: Block closures

Roel Wuyts rwuyts at vub.ac.be
Tue Aug 1 08:10:10 UTC 2000


[snip]

>> If you have comments at this eary stage, welcome. My hope is that it will
>> make it a bit "simplified and clarified" and more flexible.
>
> Speaking of "comments", the handling of comments in code is another thing
> that needs to get fixed in the present comiler.  It would greatly expand
> the set of interesting parsing, viewing, and translating projects if the
> underlying parse tree retained comments properly.
>
> There isn't a clear rule about where in the parse tree a given comment
> should live.  While pretty printing frequently makes the code look better,
> it almost always undermines the effectiveness of the comments.

Indeed, the 'comment-handling' is currently really bad. I would like to
easily rewrite a parsetree (say, optimize it, refactor it, do Java-like
before/after stuff), keeping the comments. It is currently possible, but not
clean at all. Why not have a 'CommentNode', that keeps the position of the
comment in the source. That way we can 'pull up' the comments from where
they are living now. Also note that, depending on the builder you use when
parsing, comments could be enabled or not.


--
Roel Wuyts                    Programming Technology Lab
rwuyts at vub.ac.be              Vrije Universiteit Brussel
http://prog.vub.ac.be/~rwuyts
Webmaster of European Smalltalk User Group: www.esug.org





More information about the Squeak-dev mailing list