You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But, even before this change, there is an ambiguity for input "binary_good1 = '1'b
" in single_instruction, in choosing between assignment and command_ => expression => and_expression => comparison. The way expressions are written is an "anti-pattern" for Antlr in itself not even considering assignment. But, with both involved, it will cause adaptivePredict() to run down the entire derivation chain of command_ until the end of the assignment because it's trying to find a difference based on context.
This ambiguity was copied directly from the ANSI standard, and needs to be investigated. There may be other ambiguities that can be resolved by optimizing the grammar for ANTLR's use (and moving further away from a textual match to ANSI), and the entire grammar should be analyzed looking for them.
The text was updated successfully, but these errors were encountered:
grun Rexx file_ --diagnostics does indeed indicate an ambiguity with the binary_good1 = '1'b input:
line 1:15 reportAttemptingFullContext d=11 (single_instruction), input='binary_good1 = '1'b'
line 1:19 reportAmbiguity d=11 (single_instruction): ambigAlts={1, 3}, input='binary_good1 = '1'b
'
Which makes sense - you can parse that either as assignment ("Set binarygood1 to '1'b") or as command_ -> expression -> and_expression -> comparison ("Execute the command composed of the value of the comparison of binarygood1 to '1'b"). But isn't ANTLR's processing of alternatives in the order they're written supposed to solve that ambuguity? single_instruction is firstly an assignment, and there the parse should stop - no need to consider command_. In fact, even without the input string, the grammar itself isn't ambiguous, knowing that ANTLR processes alternatives in order. No matter what the input, one token of look-ahead should identify the EQ and class it as an assignment, or not, and class it as a command_.
In ANTLR discussion 3321, @kaby76 wrote:
This ambiguity was copied directly from the ANSI standard, and needs to be investigated. There may be other ambiguities that can be resolved by optimizing the grammar for ANTLR's use (and moving further away from a textual match to ANSI), and the entire grammar should be analyzed looking for them.
The text was updated successfully, but these errors were encountered: