Open jirislaby opened 3 years ago
Note that passing (void *)addr + 1
(i.e. no parentheses around addr
) to additiveExpression
produces a good result:
As well as passing (void *)(addr)
(i.e. no +
part) to castExpression
:
If I switch the order of castExpression
alternatives, see https://github.com/jirislaby/grammars-v4/commit/624417a, it works. But the order should not matter in this case, the grammar should backtrack and try the other alternative, right?
If I comment
typedefName
intypeSpecifier
https://github.com/antlr/grammars-v4/blob/4c783b6b0f10927485c4e63007088ddbb3f777c0/c/C.g4#L240 to avoid #1979, antlr4's generated C grammar fails to parse:It says:
It only tries
castExpression
for the(addr)
part and considers+
as unary operator:But
+
should take precedence and the whole tree should start splitting atadditiveExpression
already.I am not sure whether this is the grammar issue or antlr4's one.