Hello, I have a problem with my grammar that I don't manage to solve and a little help would really be greatful :o)
Here is the situation : I use Bison for a command interpreter. I deal with variables (float values) and signals (object that contains informations and a tab of float values that can be plotted). Here is 2 examples of common use : My_var = 3. + 1. My_signal = 4. + My_other_signal Mysignal = My_other_signal + 4. Let's assume that My_var and My_signal are new identifiers, my problem is that in the second example the command "Mysignal = 4." is recognized by Bison as an integer variable assignment (with parsing error because of "My_other_signal") while what should have been done is to recognize that "4. + My_other_signal" is a signal (and process it) and then do a signal assignment. In the third example, it works fine. I don't manage to tell Bison that the priority is to process what is at the right of the '=' before assigning the result using the good rule * Here are the precedence and priority used : %right '=' %left OPERATOR1 /* '+' '-' */ %left OPERATOR2 /* '*' '/' */ %left '(' ')' %left UNARY /* for '-3' */ * Here are the rules used base : /* empty */ | var_asgn | signal_asgn ; new_id_equal : IDENTIFIER '=' { $$ = $1; } ; var_asgn : new_id_equal float_val { $$ = $2; } ; signal_asgn : new_id_equal signal { $$ = $2;} ; float_value : FLOAT_VALUE { $$ = $1; } | float_value OPERATOR1 float_value { $$ = ... } | float_value OPERATOR2 float_value { $$ = ... } | '(' float_value ')' { $$ = $2; } | OPERATOR1 float_value %prec UNARY { $$ = -$2; } ; signal : '(' signal ')' { $$ = $2; } | full_function_call { $$ = $1; } | OPERATOR1 signal %prec UNARY { $$ = ... } | signal OPERATOR1 signal { $$ = ... } | signal OPERATOR2 signal { $$ = ... } | signal OPERATOR1 float_value { $$ = ... } | float_value OPERATOR1 signal { $$ = ... } | signal OPERATOR2 float_value { $$ = ... } | float_value OPERATOR2 signal { $$ = ... } ; full_function_call : ... ; Do you have any information that could help me ? Best regards, Julien _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison