[antlr-interest] Re: antlr.TokenWithIndex (and others) should be an interface

charlweed charlweed at yahoo.com
Sun Aug 8 16:06:15 PDT 2004


--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...>
wrote:

> I might ask, however, if it's necessary to use both the rewrite
engine 
> and the hidden channel stuff.

I think I'll always need to know exacly where a token came from. My
project adds lots of source manipulation to NetBeans
(http://www.netbeans.org). It has lots of Java semantics hard coded
in, plus it needs context within the edited document. I'm pleased
about replacing the hideous and brittle AST manipulations with rewrite
rules in the grammar, but currently the whole codebase is completely
dependent on the hidden channel stuff, and its a bear to test the
validity of the re-generated code.

> In many cases this makes sense.  I wonder how many people add 
> properties to the token object.  I ask this because I'm thinking of 
> (germane to our discussions of antlr common actions) making it easy 
> within a grammar to specify both AST and token properties.  ANTLR
would 
> generate a specific impl of AST or Token (interfaces) that had all
your 
> goodies.  In this way, ANTLR actions would know if there was in
fact a 
> xxx property in the AST they are accessing etc...
> 
This sounds like it would be great! IDEs like NetBeans, are
extendable, but the most useful thing one wants to do involves
processing the source code. This requires parsing the code, and novel
manipulations on the code structures. There are all kinds of
properties one would want to assign to tokens or ASTs, but within
different contexts. It seems to me that specifying both AST and token
properties within subclass of a grammar would make it much easier to
make refactoring tools, metrics tools, "beanifiers", etc, and I'm
interested in those.



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list