[antlr-interest] Re: Error recovery - HELP

jduquevieira jpdv at medialog.pt
Thu Apr 22 01:39:55 PDT 2004


Matt, thanks a lot for taking the time to help me out.

Unfortunately, Bogdan's approach doesn't solve my problem.
>>From what I read, Bogdan solved this issue by preserving the last 
good AST tree.
This is not good enough. What happens to the input after the first 
error? Is it forgotten?

I think that what is needed in this case is a way to push into the 
input the expected tokens when an error is found.

What are your thoughts on this?

Thanks. Best regards.


--- In antlr-interest at yahoogroups.com, Matt Benson <gudnabrsam at y...> 
wrote:
> Maybe you should look into Bogdan Mitu's SATC package.
>  Check the ANTLR filesharing area...
> 
> -Matt
> 
> 
> --- jduquevieira <jpdv at m...> wrote:
> > I have a simple Math gramar.
> > And it's used in a graphical Math editor.
> > 
> > The editor user has to be able to write incomplete
> > expressions 
> > like "(2+".
> > And when the user writes this, I have to get an
> > incomplete tree, not 
> > an exception.
> > 
> > Any ideas?
> > Here goes the gramar.
> > 
> > Best regards.
> > 
> > 
> > 
> > expression
> > 	:	equal
> > 	;
> >     
> > equal
> > 	:	sum (EQUAL^ sum)*
> >     ;
> > 
> > sum
> > 	:	subtraction (PLUS^ subtraction)*
> >     ;
> > 	
> > subtraction
> > 	:	product (MINUS^ product)*
> >     ;
> > 	
> > product
> > 	:	division (TIMES^ division)*
> >     ;
> > 	
> > division
> > 	:	number (DIV^ number)*
> >     ;
> > 
> > number
> > 	:	NUMBER
> > 	|	LEFT_PARENT expression RIGHT_PARENT
> > 	;
> > 
> > 
> > 
> > 
> >  
> > Yahoo! Groups Links
> > 
> > 
> >      antlr-interest-unsubscribe at yahoogroups.com
> > 
> >  
> > 
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25¢
> http://photos.yahoo.com/ph/print_splash



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list