[antlr-interest] I'm a newbie and short of examples
cozly
cozly at qq.com
Tue Aug 19 19:07:53 PDT 2008
HI,
As we are short of examples,and bad that I'm a newbie on antlr that I'm in trouble when I just wanna have a simple (but not simple for me) demo which with this functions.
I wanna generate a Lexer and a Parser to deal with an input String (like this : william at yahoo ).
and I wrote a java class which named "dom" cause I wanna store the return result into an instance of dom.
so here is piece of code.(file: Dom.g)
grammar Google;
getDom returns[Dom o]:
IDENT at IDENT;
AT : '@';
ENDLINE : ('\r'|'\n'|'\r\n');
IDENT : ('a'..'z'|'A'..'Z')+;
and Dom.java is like this:
class Dom{
private String str1;
private String str2;
private String action;
//you can add methods to control the properties / inject the ast into this class
}
you see ? i wanna get a Dom instance which already contain the string DIRECTLY FROM THE METHOD getDom(), but sure that I still need to add something,...but bad that I don't know what to do now ?
is it clear?
would you help me please ?thanks in advance
Thanks
Bill Von Vian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080820/60749c0e/attachment.html
More information about the antlr-interest
mailing list