[antlr-interest] Seperating Grammar and Actions..
Anakreon Mejdi
amejdi at ertonline.gr
Mon Jan 13 06:23:35 PST 2003
<init> is replaced with the code put in the file.act after @init
You can write <init> as many times as you wish.
If the code which coresponds to <init> is applicable everything should
be fine.
I am not the author of this program.
It would be better to consult the readme file in the archive i poited to.
Ruslan Zasukhin wrote:
> 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 ?!
>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list