[antlr-interest] Help w/ Function Overloading

Bryan Ewbank ewbank at gmail.com
Tue Aug 9 10:24:15 PDT 2005

I was more hoping for a reference than a specific discussion of
solutions (should have known better ;-)

I know g++ must do something clever; however, I've avoided that code
because I don't want to end up with something that derives from a
GPL'ed beastie.

The language I'm supporting has:
(1) overloaded functions // C++-like
(2) defaulted parameters in the prototypes // C++-like
(3) uses return type as part of overloading // ugh.
(4) allows name/value pairs in function calls // ugh.

So, given a function
   F(a: integer, b:integer = 10)

the goal is for all these to be allowed, and call this function:
   F(1, b=3);
   F(a=1, b=3);
   F(b=3, a=1);

I'm doing name-mangling, but it seems that the number of symbols
managed for each function is exploding on me because of the allowed
name/value pairs in function calls - it smells funny, if you will.

Since it smells funny, I was asking for general references on how to
do function overloading, etc.  Some compiler texts ignore overloading;
others treat it as an uninteresting problem or start with "now that
you have the AST..."

Next stop, http://citeseer.ist.psu.edu/

- Bryan

More information about the antlr-interest mailing list