On Fri, 5 Aug 2005, Aaron Hurst wrote: > [...] However, I would like to be able to parse > implicit multiplication (i.e. if two expression appear next to each > other without an operator, they should be mulitplied).
[...] > | expression expression %prec '*' /* this rule causes problems */ This is an excerpt from the 'parser.output' file generated by Bison from the GNU 3DLDF grammar: 886 numeric_secondary: numeric_primary 887 | numeric_secondary TIMES numeric_variable 888 | numeric_secondary numeric_variable | ... State 888 corresponds to the rule for what you're calling implicit multiplication. In my grammar, there are no conflicts associated with this state. In order for this to work, you will need to use an expression hierarchy, i.e., 'expression' is not enough. The general pattern is: type_variable: ... type_primary: type_variable | ... type_secondary: type_primary | ... type_tertiary: type_secondary | ... type_expression: type_tertiary | ... For 'numerics' I have a couple more stages, but you may not need them. I've described this technique in previous postings to this mailing list. Hans Aberg has also published an article on a similar but more general technique. Laurence Finston http://www.gnu.org/software/3dldf/LDF.html _______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison