[antlr-interest] Seperating Grammar and Actions..
Anakreon Mejdi
amejdi at ertonline.gr
Mon Jan 13 06:08:47 PST 2003
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.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list