[antlr-interest] ANTLR 3.0ea3 released

Gerald B. Rosenberg gbr at newtechlaw.com
Fri Jun 24 08:18:51 PDT 2005


At 09:18 AM 6/24/2005, Paul Johnson wrote:

>Alex Sedow wrote:
>
>>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.

True for well defined, highly constrained source data.  But where the 
source contains context that is determinable only from some progression of 
nodes, the amount and complexity of carry forward can quickly outweigh the 
effort of doing a look-back.

In my case, the source data contains multiple overlapping contexts.  At a 
given node, carry forward would require sorting through an expansive set of 
of only potentially relevant data in a proprietary data structure with only 
a limited ability to know what may be pruned for subsequent nodes.  But the 
tree neatly carries all of this information and a reverse tree-walk gives 
an immediately narrowing identification of the applicable context.

Even where carry forward would work, look-back may simply be a cleaner 
conceptual model in some situations.
----
Gerald B. Rosenberg, Esq.
NewTechLaw
285 Hamilton Avenue, Suite 520
Palo Alto, CA  94301-2576

650.325.2100  (office)  /  650.703.1724  (cell)
650.325.2107  (fax)

www.newtechlaw.com




More information about the antlr-interest mailing list