[Newcompiler] [ANN] First version of Shout usingnew SqueakParser/SqueakScanner

Andrew Tween amtween at hotmail.com
Sun Aug 27 20:45:18 UTC 2006


Hi Math.

----- Original Message ----- 
From: "Mathieu Suen" <mathieusuen at yahoo.fr>
To: "The New Compiler, AST, IRBuilder,Closures..."
<newcompiler at lists.squeakfoundation.org>
Sent: Sunday, August 27, 2006 4:39 PM
Subject: Re: [Newcompiler] [ANN] First version of Shout usingnew
SqueakParser/SqueakScanner

..snip...

> Hi Andrew,
>
> I have looking your Scanner and I think the tokenList could help us to
> find where to put comment and whitespace. The list is a bit the same as
> the nodes list when we build the tree but nodes don't containt comment
> and whitespace and nodes is always changing.

If a tree visitor also had access to a tokenList then it could query a token for
its preceding/following whitespace/parenthesis/comments etc. Comments could be
queried to see if they were on a line by themselves, whether a comment is the
first comment in a method etc. All it would need is some helper methods to find
a token's index in the list and navigate up and down the token list from that
point, analysing each token appropriately.

>
> To put comments/whitespace/parentheses/periodes on the tree it could be
> easier to bring them in nodes and override #reduce:.
>
> Don't he?

Things like empty statements
    e.g. as in :    a:=1. .."comment". . . b:=2

 might be easier to leave in the tokenList rather than adding to the tree. I
don't know. I am sceptical that adding everything to the tree is the best
approach. But, maybe I just haven't thought it through in enough detail. Of
course, the most important thing is that the required information is available,
not where it is stored.

>
> But for shout I think tokenList it's mush simpler.

The main reason for creating and using the token list for Shout is so that
syntactically incorrect source can still be highlighted up to the position of
the syntax error. It then follows that if this technique works for syntactically
incorrect source, then why not use it for syntactically correct source too.

Cheers,
Andy

>
> Math
>
>
>
>
>
>
>  p4.vert.ukl.yahoo.com uncompressed Sun Aug 27 15:27:00 GMT 2006
>
>
> ___________________________________________________________________________
> Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet
!
> Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos
expériences.
> http://fr.answers.yahoo.com
>
>



More information about the Newcompiler mailing list