[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some questions...



On Tue, Aug 28, 2001 at 02:13:34PM +0100, Jim wrote:
>   [Jim] I understand when the in and out methods are called, I was talking
> about specifically setIn/getIn/setOut/getOut - it just seems a little odd to
> have two separate hashes for each node.  I am presuming that you are
> supposed to store attributes gathered during the execution of an inXXX
> method using setIn and the attributes calculated in the outXXX method using
> setOut...

This was mainly meant for storing "analysis data".  Such data is usually
described as IN/OUT sets, in standard optimizing compiler books.

>   [Jim] Thanks for all that info.  Another thing I am not sure about is the
> TypedLinkedList thing and all these funny cast classes.  It looks like some
> established technique for doing collections that has passed me by, can
> somebody give me a pointer to something on it?  I looked at the code but had
> a hard time seeing what was going on (so it's a bit embarassing to have to
> ask, but time is of the essence).

Just don't worry about it (this is why I tried hiding it behind the
"LinkedList" interface).  Mainly, a "TypedLinkedList" is a linked list that
checks that inserted elements are of the appropriate type.  This is used to
make sure no "corruption" happens in the AST.  [You certainly do not want
a linked list of PStmt (in your AST) to contain a java.awt.Button...]
TypedLinkedList makes sure a cast exception is thrown at the point somebody
tries to add an incompatible object into the linked list.

Etienne
-- 
Etienne M. Gagnon                                    egagnon@j-meg.com
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/