[antlr-interest] Doubt About using custom classes from returing values

Jim Idle jimi at temporal-wave.com
Tue Aug 10 15:44:50 PDT 2010


You might try adding your classes via the classpath in the Compiler tab of
Preferences. However ANTLRWORks is a pure grammar debugger really, it is
better to build your project with Maven and Netbeans, (there is a good ANTLR
plugin for maven),then generate with the debug option and debug the grammar
remotely.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Victor Giordano
> Sent: Tuesday, August 10, 2010 2:42 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Doubt About using custom classes from
returing
> values
> 
> mmmmmm, the correct question i wanted to do is: How to compile within
> ANTLRworks using outer classes definitions... cuz it's says to me that
doesn't
> know the return value type.. :(.
> 
> 
> El 10/08/2010 06:17 p.m., Victor Giordano escribió:
> > Hi There!! Me Again!.
> > I have another simple cuestion (i hope the answer be simple too!).
> >
> > So if a wanna use rules that return values but custom types values,
> > like, in java, objects instances from custom classes.
> > Example:
> >
> > streetFightRule returns [MyHappyClass MyReturnObj] :
> > TOKEN 'VS' TORYU
> > {
> > 	MyReturnObj = new MyHappyClass (TOKEN,TORYU); };
> >
> > How i configure this? With my working proyect.. I am a huge fan of
> > netbeans.. by the way, if you know a way of integrating all in one
> > tell me please!.
> >
> > Well that it's all!!.
> > Thankssss again!!.
> > Cya.
> >
> >
> > El 10/08/2010 05:31 p.m., Victor Giordano escribió:
> >> Thanks Junkman!!! But it's still doesn't work... :(.
> >> I have another example:
> >>
> >> rule: TOKEN1? TOKEN2 ->   ^(TOKEN1 TOKEN2) Works when token1
> actually
> >> exists, but when no.. :( ugly things happen..
> >>
> >> Well, thanks for advance again!!.
> >> Cya.
> >>
> >>
> >>
> >> El 10/08/2010 05:00 p.m., Junkman escribió:
> >>> Hi Victor,
> >>>
> >>> Victor Giordano wrote:
> >>>> Hi, i am a newbie. Trying to figure out how to work with AST tree
> >>>> and
> >>>>
> >>>> ...
> >>>>
> >>>> butttttttt if i want to use rewrite rules... how do i thread the
> >>>> repetion EBNF operator like * or +.
> >>>>
> >>>> expr : term (('+'|'-') term)* ->    term ^(('+'|'-') term)* ;
> >>>>
> >>>
> >>> try this:
> >>>
> >>> expr: ( term ->    term )
> >>>          ( ( '+' | '-' ) term ->    ^( ( '+' | '-' ) $expr term ) )* ;
> >>>
> >>>
> >>> Not sure if the terms need to be distinguished with labels.
> >>>
> >>> The Antlr reference book describes the use of rewrite rule inside
> >>> subrule in more detail.
> >>>
> >>> J
> >>>
> >>
> >>
> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> >> Unsubscribe:
> >> http://www.antlr.org/mailman/options/antlr-interest/your-email-addres
> >> s
> >>
> >
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe:
> > http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> >
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list