Notes...
"grammar A;;" says
error(17): A;.g:1:10: extraneous input ';' expecting EOF
in v3:
CodeGenerator.generateLocalFOLLOW():
if ( follow.member(Label.EOF) ) { // TODO: can we just remove? Seems needed here: // compilation_unit : global_statement* EOF // Actually i guess we resync to EOF regardless follow.remove(Label.EOF); }
I think we do need EOF. dang. I'm running into an error recovery set that doesn't have EOF when it's needed.
Havng trouble figuring out what "exact" parameter does in combineFollows() in runtime.
it seems to only add sets from above on stack if EOR is in set i. When it sees a set w/o EOR, it stops adding. Why would we ever want them all? Maybe no viable alt instead of mismatched token?
a : sync ( stuff sync )* ;
should be part of ()* DFA (for entry/exit/choice). check looks for mismatch (via dfa). If fails, consumeUntil start of loop or follow of loop. Recheck to see if dfa predicts loop. If it does, enter. If predicts exit, then just exit and proceed normally.
Code templates say:
/** Same as a normal DFA state except that we don't examine lookahead * for the bypass alternative. It delays error detection but this * is faster, smaller, and more what people expect. For (X)? people * expect "if ( LA(1)==X ) match(X);" and that's it. */ dfaOptionalBlockState(k,edges,eotPredictsAlt,description,stateNumber,semPredState) ::= << int LA<decisionNumber>_<stateNumber> = input.LA(<k>);<\n> <edges; separator="\nelse "> >>
I'm reversing my opinion.
element in antlr grammar had acyclic k>1 predictor. Upon a : A b : B ; (missing , it gets stuck at "b:" not ":". Hard to add error alt. had to do .* COLON.