visitor that performs various consistency checks over the AST.
The string argument will be used in the error message in case of
inconsistency, in order to trace the issue. is_normalized defaults to
true. Some checks are deactivated when it is set false.