I'm trying to give a semantic value to a list of comma-separated values. In fact, I have defined the reduction rules for bison using
commasv : exp
| commasv "," exp
where exp
its a number or a variable or a function pointer or, also, a commasv token with its respective syntax and semantic rules. The type of exp
is double so the type of commasv
must be double.
The thing is that I want to store the list in order to use it, for example, on a function call. For instance
h = create_object()
compute_list(h,1,cos(3.14159))
will give the expected result of a certain compute_list
function.
As basis bison file I've used mfcalc example from the bison manual and I replaced the yylex
function by other one generated using flex. By now I can do things like
pi = 3.14159
sin(pi)
ln(exp(5))
with the modified version of yylex
function with flex but I want use the comma-separated values with function calls, lists creation and more.
Thanks for your answers.
,
operand. (stack or queue). In my case it was an stack, but it could be different for you. – Adrián