[antlr-interest] Seperating Grammar and Actions..

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Jan 13 06:21:19 PST 2003


on 1/13/03 4:08 PM, Anakreon Mejdi at amejdi at ertonline.gr wrote:

> There is annotation-20020416.zip in the files section at yahoo.
> Here is an example:
> 
> class CalcTreeWalker extends TreeParser;
> 
> expr <init>
>    :   #(PLUS <p1>expr <p2>expr)   <p3>
>    |   #(STAR <s1>expr <s2>expr)   <s3>
>    |   <i1>INT                   <i2>
>    ;
> 
> in a separate file (say file.act) you can define:
> @init: code in the desired  language
> @p3: some other code
> call java annotation.Insert -s your_grama_file -i file.act -d output.g
> 
> output.g is parsable by antlr and has antlr code with tags replaced by
> the code defined in @init, @p3 ,...
> 
> For more information see the readme.txt file included in the archive.

But if names as <init> must be unique in the global scope ?

I.e. Can I in the next rule use it again ?
 (it seems I cannot)

And I wonder, if exists info about this feature on ANTLR site or archive?
How on earth new visitor can find this info ?!

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on at lists.macserve.net
-------------------------------------------------------------


 

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



More information about the antlr-interest mailing list