[antlr-interest] Minor suggestion re. Java output

Guntis Ozols guntiso at latnet.lv
Tue Feb 5 06:35:40 PST 2008


>  - Remember that the Java code target is 1.4;
>  - The code is put together by the string template hence it is a view
> and cannot know anything about the model;
>  - All the elements of the output can be derived from, hence these
> questions are about being lazy. I am all for development tools allowing
> one to be lazy, but only as lazy as possible. There is a bigger view to
> consider here;
>
> Jim

It is also about less memory/cycles for each node and smaller/simpler code.

The question that is puzzling me is:
  if java code target was 1.5 or later
  would then it be possible for CommonTree to return CommonTree children?

I think the typical use cases are (no casting necessary, covariance ok):
  - use default ast
  - extend TreeAdaptor and extend Tree/BaseTree/CommonTree

How typical do you think is to create a tree with nodes that are
instances of CommonTree having children that are not? (btw, BaseTree.children
is protected, can be accessed anyway)

Guntis



More information about the antlr-interest mailing list