[Newcompiler] Properties for AST

Stéphane Ducasse stephane.ducasse at univ-savoie.fr
Mon Apr 9 07:00:18 UTC 2007


Hi

I have a question is the information retained useful for other tools.
I was wondering if it would not make sense to have multiple  
representations of the tree.
Then I was wondering if this is not a clear indication that we would  
need
hashBasedSubclass: in addition to the one we have

Stef

> Hello,
>
> Yesterday I merged some work done earlier into the current version  
> of the AST package.
>
> The problem with the RB AST ist size: Just using the AST and  
> NewCompiler as is, the AST
> is quite huge. An image that keeps the complete AST of all methods  
> is ca. 800MB in size.
>
> The reason for that is that far too much information is retained:  
> the AST holds on the original text,
> all the scanner tokens, the Intermediate representation,  
> information from semantic analysis... and
> all this information is saved in instance variables of the Node  
> objects, which in turn are nil most
> of the time. (once you have 1.5 Million objects of something, an   
> instance variable that is nil
> does indeed cost memory ;-))
>
> Over the next weeks/months I will slowly work on making the  
> representation far more compact.
>
> As a first step, there is now a property interface on  
> RBProgramNode. This allows to reduce the amount
> of instance variables: The idea is to have the AST encode just what  
> realy is the AST directly (including
> names of variables), keeping all the transient data (e.g. semantic  
> analysis data of the compiler) or
> meta-data (formatting, comments) as properties.
>
> The next step will be to get rid of the Scanner Tokens.
>
> 	Marcus



More information about the Newcompiler mailing list