eth-cscs / modparser

BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Use exceptions to handle compiler errors #13

Closed bcumming closed 9 years ago

bcumming commented 9 years ago

Currently catastrophic errors, where a error occurs due to incorrect compiler implementation, are handled with assertions.

There are enough points in the compiler where such tests are performed. e.g. some AST visitor implementation has AST node types that it should never be called on, and if the visitor finds itself visiting one it is a sign that there was a problem with the compiler implementation. In such cases, instead of just assert(false), should we throw an exception which is handled in a uniform manner?

delalond commented 9 years ago

I agree with you we should remove asserts and implement error handling.

bcumming commented 9 years ago

A compiler_exception is now thrown when the compiler finds itself in a bad state.