When I compile the below grammar with bison test.y
, it warns that the nonterminals "header_stms" and "forward" are useless. Why? They are used in the "program" rule. The nonterminal "stm" is not reported useless.
%%
program: /* empty */
| stm
| header_stms
;
header_stms: header_stms forward
;
/* forward proc declaration */
forward: "forward" TK_ID ";"
;
stm: TK_ID "+" TK_ID
;
%%
The rules that use those nonterminals are also deemed useless.