Skip to content

Mercury should abort processing on syntax errors #63

@pchapin

Description

@pchapin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmercuryPertaining to the Mercury IDL compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions