The problem is that unadorned function application is ambiguous with respect to all of your binary infix and prefix oparators -- should an input like a b + c
be parsed as (a b) + c
or a (b + c)
? Since there's no token involved in function application, the normal yacc/bison precedence rules won't work for it without extra help.
Assuming you want to give function application the highest precedence (the normal case, I beleive), you can make this work with some extra work.
Add the following precedence rule to the end of your list (highest precedence):
%left FUNCTION_APPLICATION T_NUM T_ID '{' '('
Make your function rule:
| e[fun] e[arg] %prec FUNCTION_APPLICATION { $$ = mk_app($fun,$arg); }
depending on what you have elsewhere in the grammar, you might need to add some more tokens to the precedence rules and/or rearrange things slightly. In particular, every token in FIRST(e) needs a precedence, and if its precedence for function application is different from its precedence for other uses, things won't work (as each token can only have one precedence). As long as function application is higher precedence than everything else, things should be resolvable.