[antlr-interest] antlr 2.7.x: error messages question

Costa Basil costa_basil at yahoo.ca
Sun May 13 00:42:11 PDT 2007


I have a k=3 grammar (output c++) and I have an issue with the syntax error messages displayed by antlr.  Antlr detects syntactic errors as early as possible. Because k=3 antlr usually checks 3 tokens ahead using the linear approximation. Sometimes token 2 or token 3 are the culprits but the message shows only token 1.

For instance, I can get the unexpected token error but actually that token is correct and the token after is incorrect.

I think a better message would be: unexpected token sequence and then show token 1, token 2 and token 3.

The problem is that for some productions only token 1 is wrong (including all the cases when there is no need to look ahead 3 tokens), for others token 2 or token 3 are wrong. In the first case the default message is right. In the other case I would say: unexpected token sequence because I really don't know which token is the offending token.

Any thoughts?

Thanks


 		
---------------------------------
Share your photos with the people who matter at Yahoo! Canada Photos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070513/941dddf1/attachment.html 


More information about the antlr-interest mailing list