I've written a flex/Bison grammer which works perfectly untill a certain point. But when I add a new non-terminal with a new grammer rule - no matter which one I get the following warning: warning: rule useless in grammar [-Wother]
when i move the very same rule to a different non-terminal It works fine. It's like I can't add any more non-terminals.
This is the part of the code which doesn't work:
%type<number> expression
%type<arr> array
array:
'[' expression ']' { cout << "SUCCESS" << endl; }
;
expression:
NUMBER { $$ = $1; }
;
all type are predefined in the union and I've been trying to change rules/non-terminals order. Nothing works. Please help as I can't figure out what's the problem!