[antlr-interest] Re: Seperating Grammar and Actions..

cintyram <cintyram at yahoo.com> cintyram at yahoo.com
Mon Jan 13 07:59:59 PST 2003


Thank you for pointing me to the tool .
essentially this is what i was going to do too!! may be i would have
chosen different symbols instead of @ etc .. ; but every thing else
same :)

Now that it is already there i saved some time , and also thanks to
bogdan mitu :) !
i hope to be able to provide some more examples for that in the next
week or so! 

cheers
ram


--- In antlr-interest at yahoogroups.com, Anakreon Mejdi <amejdi at e...> wrote:
> <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 e... 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