[antlr-interest] C# Error Recovery

Terence Parr parrt at cs.usfca.edu
Thu Apr 17 10:58:00 PDT 2008


On Apr 17, 2008, at 10:12 AM, Johannes Luber wrote:
> Not entirely stylistic. After all, Ter used procedural programming  
> in a place, which could benefit from polymorphism. Having a catch- 
> all clause doesn't very well with me. Using the compiler to choose  
> the right text message is easier and one might not have to override  
> getErrorMessage().

I disagree...Another example of people thinking objects of the answer  
to everything. Okay so subclass all of the exceptions in your  
application. Now, how are you going to get ANTLR to generate those  
exceptions instead of the standard ones? You will now have to go  
modify all the templates and runtime code to be able to deal with  
exception factories or something else. Having all error messages  
handled through one method is extremely appropriate because it groups  
everything into one location and makes it much easier to  
internationalize using templates and so on.

As you can tell for my comment on that function, I thought about it  
quite a bit. I even tried it the other way.

Ter


More information about the antlr-interest mailing list