Mail Archives: djgpp/1999/06/30/12:29:12
>I am trying to get bison to accept multiple parameter functions. Does
>anyone know how to do this? I got single params to wolk by looking at
>the calc exemple in the info files, but multiple doesnt work that way.
if you're writing the Bison code to read and interpret and run the script
all at the same time it gets a little problematic. that's because it's
difficult to parse a GENERAL set of functions with varying parameter lengths
at run-time. the only simple way to do it that I can see is have either (1)
a set of nonterminals that collect a set number of parameters and call the
function with those parameters, or (2) have a nonterminal that gathers the
arguments sent to the function, for example, push them onto an internal
stack, then, instead of calling the function immediately, call an
intermediate function that calls the function and uses the va_args functions
to pass the parameters.
if you run it compiled as byte-codes, that's another thing. or, if you only
expect certain functions to ever be executed, you can simply look for them
specifically. like i said, it's difficult to run a GENERAL set of functions
with varying parameter list lengths at runtime. if you take away one of
these it gets much simpler.
-={C}=-
- Raw text -