delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/30/12:29:12

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: Bison help
Date: Tue, 29 Jun 1999 16:50:03 -0600
Message-ID: <01bec281$ba1a2d40$LocalHost@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com


>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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019