[antlr-interest] TokenStreamRewriteEngine: possible to use non-terminals instead of tokens?

Terence Parr parrt at cs.usfca.edu
Wed Feb 4 11:08:58 PST 2004


On Feb 4, 2004, at 11:01 AM, SainTiss wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wednesday 04 February 2004 19:42, Terence Parr wrote:
>>
>> You need context info to trickle into typeSpec so that it knows when 
>> to
>> remove that token.  you can pass a parameter around or set a context
>> instance variable (ick).  Or, go the other way: just set an index in
>> typeSpec as to the index of the ID token.  Then later if you ever want
>> to delete it, you know the index.
>
> I think I get the idea of what you're saying here... Setting an index 
> in
> typeSpec intuitively seems the most elegant way to go to me, but is 
> there
> documentation available on how to accomplish this? I mean, I guess it's
> needed to add an attribute to typeSpec's class definition, which is 
> probably
> built-in to antlr?

There is no typeSpec.  Remember that antlr generates a method for each 
rule not a class, which is really icky...

just define an instance variable and set it with an action.

Ter
>
> Thanks,
>
> Hans
>
>
> - --
> Ark Linux - Linux for the Masses (http://arklinux.org)
>
> Capitalism:
> You don't have any cows. The bank will not lend you money to buy cows,
> because you don't have any cows to put up as collateral.
>
> Representative Democracy:
> You have two cows. Your neighbors pick someone to tell you who gets 
> the milk.
>
> In a world without walls and fences, who needs windows and gates?
>
> Hans Schippers
> 2LIC INF
> UA 2003-2004
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
>
> iD8DBQFAIUGjXlnUYIbmLOQRAh3yAJ9mvkG9Vb/WD0j75gz509+EoiFNAQCffpL4
> AKza8UQe1wOT0oSXtZIal18=
> =mWv8
> -----END PGP SIGNATURE-----
>
>
>
>
> 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/
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

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