I have been reading through the Bison manual the past couple days.
I really
liked the three examples, especially the last - the multifunction
calculator. Since reading that I have been wondering if there was
a general
way to describe a function that can take on any number of arguments
in the
grammer rules?
I suppose that I could just do something like,
| FNCT '(' exp ')' { $$ = (*($1->value.fnctptr))($3); }
| FNCT '(' exp ',' exp ')' { $$ = (*($1->value.fnctptr))($3,$5); }
| FNCT '(' exp ',' exp ',' exp ')' ...
I could go on like that to all for as many arguments as I wanted
to / needed
to. However, I would also like to create a "plug-in" system where
users can
create their own functions and add them to the application. Thus a
avoiding
a limit on arguments would be desirable.