Hi I tried your grammar For const_var_dim_list , you had given as const_var_dim_list : const_var_dim_list const_var_dim ; but where is const_var_dim_list again defined. (like what does it get reduced to) So bison errs saying 2useless nonterminals,
I tried some thing like this Const_var_dim_list : const_var_dim , now it goes without any glitches. But if I put Const_var_dim_list: /*empty*/ | const_var_dim , then there is one shift/reduce conflict for that production , I could find only this much , Hope this helps. Vidya -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SirZooro Sent: Sunday, September 17, 2006 6:52 PM To: Help-bison@gnu.org Subject: Why bison doesn't like my grammar? Hello, I was found this problem while trying to eliminate shift/reduce conflicts from my grammar. Bison (version 2.3, Cygwin) reports that some of my rules are useless, and I don't know why. Could you look on this and tell me what's wrong? I want to describe something like this (array dimensions, default value and 'global' are optional): variables { var_aaa[3][2] : 8 = 123 global other_var : x } Daniel Useless rules: 11 variable_decl: TOK_SYMBOL const_var_dim_list ':' const_int_function var_default var_global 12 const_var_dim_list: const_var_dim_list const_var_dim 13 const_var_dim: '[' const_int_function ']' Grammar file: %token TOK_VARIABLES TOK_SYMBOL TOK_X TOK_GLOBAL TOK_NUMBER '{' '}' '[' ']' ':' '=' %token TOK_NUMBER %glr-parser %% variables : TOK_VARIABLES '{' variables_list '}' ; variables_list : /* empty */ | variables_list variable_decl ; variable_decl : TOK_SYMBOL ':' const_int_function var_default var_global | TOK_SYMBOL const_var_dim_list ':' const_int_function var_default var_global | TOK_SYMBOL ':' TOK_X ; const_var_dim_list : const_var_dim_list const_var_dim ; const_var_dim : '[' const_int_function ']' ; var_default : /* empty */ | '=' const_int_function ; var_global : /* empty */ | TOK_GLOBAL ; const_int_function: TOK_NUMBER ; -- View this message in context: http://www.nabble.com/Why-bison-doesn%27t-like-my-grammar--tf2286045.html#a6 349993 Sent from the Gnu - Bison - Help forum at Nabble.com. _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison