Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

I'm reversing my opinion. We must not delay error attention. If we Don't see the start of an EBNF constructs, we should generate an error and trigger recovery. In fact, we should try to sync/recover at the start of these constructs and within just like this:

a : sync ( stuff sync )* ;

That way, we can get rid of crap in front of an optional element instead of bypassing the optional element and then getting a really strange error that we are missing whatever followed that optional element.

element in antlr grammar had acyclic k>1 predictor. Upon a : A b : B ; (missing (wink), it gets stuck at "b:" not ":". Hard to add error alt. had to do .* COLON. Actually makes sense. it's (TOKEN_REF|RULE_REF)COLON that says we are missing a ';'.