[antlr-interest] A few ANTLR 3.0b4 questions
Foolish Ewe
foolishewe at hotmail.com
Wed Nov 15 15:33:42 PST 2006
Hello All:
I'm trying to use ANTLR 3.0b4 in ANTLRworks, and I have a few things I'd
like to ask.
1) I'm chomping at the bit to try Ter's new Anltr 3.05b (if I have the
version number right),
so I'm looking forward to the new release of ANTLRworlks. If anything
I'm asking
is fixed in the new version, I haven't had a chance to try it yet due to
my choice of
development environment, so just let me know.
2) I am using an AST but for some reason, neither @header{} @members{} seem
to have the deisred behavior as appears to be
indicated in the wiki nor does header{} appear to work. I want to set
the java package
name and perhaps use some imported libraries.
The relevant syntax looks like:
grammar MyGrammar;
options{
output=AST;
}
/* This won't compile
@header{
package mypackage;
}
// Additional members for the derived Parser class
@members{
public static void main(String[] args) throws Exception {
// Body of main omitted
}
}
*/
tokens{
// This all works.
}
3) I would like to add some Java source to invoke some actions in my
grammar.
Do I need code to walk the AST, or can I try to accomplish them during
the AST
construction phase, I expect I'll be using both inherited and synthetic
attributes in my rules.
If I have a rule like
command:
(
c1=commandType1->(COMMAND $c1) // Here I would like java code for
command processing
|
c2=commandType2->(COMMAND $c2) // Here too
);
I took a quick look at the wiki and it appears there is some @actions stuff
but I don't grok it yet.
Regards:
Bill M.
_________________________________________________________________
Get the latest Windows Live Messenger 8.1 Beta version. Join now.
http://ideas.live.com
More information about the antlr-interest
mailing list