Mail Archives: djgpp/1999/06/28/11:25:36
Denis Lamarche wrote:
> ya, but then I would have to go:
>
> exp: FUNC2 '(' exp ',' exp ')' {$$ = func2($3,$5);}
> exp: FUNC2 '(' exp ',' exp ',' exp ')' {$$ = func2($3,$5,$7);}
> exp: FUNC2 '(' exp ',' exp ',' exp ',' exp')' {$$ =
> func2($3,$5,$7,$9);}
>
> and so on...isnt there a way I could do it for all possibilities?
Oh, so you want to accept something like printf in C?
OK, that's tougher, but here's what comes to mind:
fcallBegin: FUNC '(' {$$.clear(); $$.add($1);}
| fcallBegin exp ',' {$$.add($2);}
fcall: fcallBegin ')' {func($$);}
Here, you would have to make some sort of list class (or the equivalent
in C), and it would hold the function name & all of the arguments passed to
it. You would need to code a wrapper for the function you want to call that
accepts the list class and does the real call itself.
--
-Rolf Campbell (39)3-6318
- Raw text -