[antlr-interest] stuck expr

jagad jagad at enciety.com
Wed Oct 1 07:30:03 PDT 2003


Gotcha! :)
I use "expr" at my xxx.g file!

Thanks Monty, I'll fixed it and see how it goes

Best Regards

jagad


On Wed, 2003-10-01 at 21:16, mzukowski at yci.com wrote:
> See that parser.expr()?  That's where you are calling the expr rule at the
> top level.  Sounds like you really want to be calling parser.goal().
> 
> Good catch, Ric.
> 
> Monty
> 
> -----Original Message-----
> From: jagad [mailto:jagad at enciety.com] 
> Sent: Wednesday, October 01, 2003 7:25 AM
> To: ANTLR Milis
> Subject: Re: [antlr-interest] stuck expr
> 
> Hi Ric,
> 
> Yes, I call MyParser.expr() and No, I don't cut out, the whole result
> it's just like I sent.
> 
> Here my snippet:
> 
> #include "parser/MyParserLexer.hpp"
> #include "parser/MyParserParser.hpp"
> #include <iostream>
> #include <sstream>
> 
> int main()
> {	
> 	ANTLR_USING_NAMESPACE(std)
> 	ANTLR_USING_NAMESPACE(antlr)
> 	
> 	try{		
> 		MyParserLexer lexer(cin); 
> 		MyParserParser parser(lexer);
> 	
> 		parser.expr();
> 	}
> 	catch(exception& e){
> 		cout << "exception: " << e.what() << endl;
> 	}
> 	
> 	return (0);
> }
> 
> ---------------
> 
> The snippet just like the ANTLR example :)
> I have read the generated code (as adviced by Monty) and it's strange
> that goal() not called at the first time. Could you give me info where
> actually the first ANTLR C++ call ?
> 
> Best Regards
> 
> jagad
> 
> P.S: Is it possible that sleepless affecting my code? :) just joke,
> ANTLR is great and your works at ANTLR C++ is great. Great Tools with a
> newbie hand like me could be a problem :)
> 
> 
> On Wed, 2003-10-01 at 20:57, Ric Klaren wrote:
> > On Wed, Oct 01, 2003 at 09:05:07PM +0700, jagad wrote:
> > > I use -parserTrace and try input:
> > > 
> > > (1+2),(1+3);
> > > 
> > > The Output:
> > > ------------------------------------
> > >  > expr; LA(1)==(1+2),(1+3);
> > 
> > Hmmm you are calling the goal rule I hope? And not MyParser.expr() ? Or
> did
> > you cut out the traces for goal and exprList ?
> > 
> > Cheers,
> > 
> > Ric
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list