I created a grammar for boolean expressions and now I'm trying to implement visitor for evaluating it.
It is told that there is no need to overcomplicate grammar lexer and parser rules with semantic analysis because it is much better to provide meaningful error messages from the Visitor.
So I'm trying to check type consistency, date correctness etc in the Visitor. And the surprise I get is there is no way (at least I don't see it) to report an error from the Visitor other than throwing exceptions. And if I throw an exception I won't be able to proceed with expression validation and detect all errors at once. In addition I have to catch somehow all parsing exception types (how should I know them?). All in all, exception throwing doesn't seem to be correct solution.
Could you give me a direction how it is planned to report errors in expression semantics during Visitor traversal?