-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Mercury ignores syntax errors and continues processing input through semantic analysis and code generation. Since the parser's error recovery could be better (it does nothing other than whatever ANTLR does by default), syntax errors cause a questionable parse tree to be sent to the later stages of Mercury's pipeline, which is very crash-prone.
The suggestion here is that Mercury should abort processing after syntax errors have been reported. This is a relatively easy fix. It would clean up a source of crashes while allowing the later stages of processing to legitimately assume a proper parse tree is given as input to those stages.
Ideally, the parser would have some intelligent recovery so that a reasonable approximation of a parse tree would be produced even after a failed parse. Semantic analysis could then proceed in a useful way, with the tool aborting just before code generation. However, this is more complicated to implement and different from what this ticket is about.