[antlr-interest] ANTLR 3.0ea3 released

Alex Sedow alex at csharpparser.com
Fri Jun 24 10:18:33 PDT 2005


>> Yes, but what do if you need multiple context informations?
>> For C# partial types is needed use mutiple AST-contexts depend on 
>> placement of part declarations in source files. Example:
>>
>> // file1
>> using I = I1;
>> partial class C : I {} // point1
>> // file2
>> using I = I2;
>> partial class C : I {} // point2
>>
>> Note: all parts of partial type (on type-lookup) must be processed 
>> together in point1 or in point2.
>> I think for this case the best way is generate and use pointer to 
>> AST-parent.
>
> I'm having a problem seeing when it would be necessary to look back up a 
> tree. At first sight, it seems to me that this is only necessary when 
> you're carrying out processing during tree construction. If you defer 
> processing till after tree completion, then surely you can always pass the 
> required information down, rather than up.
>
> Or have I missed the point?

In this case parents and children can be in pairs defined in different 
AST-trees. For correct processing using-directives defined above on a tree 
should be taken into account. I.e. it is necessary to use at once 
multiple(!) AST-contexts. If AST-nodes contain references to parents 
AST-nodes then they represent a AST-context. Otherwise it is necessary to 
save just in case in each tree the data on which it is possible to restore a 
context. And these data as a matter of fact will be equivalent to references 
to AST-parents.

--
Alex. 



More information about the antlr-interest mailing list