3 ms·
A compiler is in the happy position where there is little point in continuing to run after encountering an error, so it can bail right out with exit(2) after re
by caf 8y ago
A compiler is in the happy position where there is little point in continuing to run after encountering an error, so it can bail right out with exit(2) after reporting the error to the user. This means that the contract on parse(), for example, can be that if it returns, it has succeeded.
- vlovich123 8y agoExcept of course LLVM has proven the value in not assuming this pattern & building your compiler as a library of which the executable entrypoint is but one frontend.
- Asooka 8y agoExceptions are the exit() of libraries. Or if you're using plain C, setjmp/longjmp might be a good idea, depending on what you're doing.