softwarelanguageslab / maf

Static Analysis Framework for Modular Analyses
Other
13 stars 12 forks source link

Configurable error handling/states #29

Closed bramvdbogaerde closed 2 years ago

bramvdbogaerde commented 2 years ago

Currently, if the analysis encounters a (semantic) error in the program under analysis, the analysis results in bottom.

It might be interesting to add an extension to MAF to support error state (for alle kinds of errors, type errors, variable lookup errors, ...) and make it configurable so that bottom can still be returned or an exception can still be thrown if desired.

noahvanes commented 2 years ago

The good news is that we already have a configurable way to ignore or include those errors in the places where they occur most (i.e., the primitives) because of the monadic abstraction with ‘MonadError’: analyses that want to ignore failures can just implement method ‘fail’ as bottom, while others can keep the information. Perhaps we can take a similar approach for the analyses themselves as well?

noahvanes commented 2 years ago

Also related to: #21

noahvanes commented 2 years ago

Proposed solution has been implemented (see 9d98129). One can easily configure how to handle/model errors by providing an appropriate implementation of method fail. By default, this method now logs the error (to aid debugging) and returns bottom (which causes the analysis to halt for the program path where the error was encountered, but does not include any information about the error state in the analysis results).