Re: representing functions with arguments in an abstract syntax tree

"jacob navia" <jacob@jacob.remcomp.fr>
2 Jan 2004 03:43:38 -0500

          From comp.compilers

Related articles
representing functions with arguments in an abstract syntax tree melkorainur@yahoo.com (2003-12-27)
Re: representing functions with arguments in an abstract syntax tree torek@torek.net (Chris Torek) (2004-01-02)
Re: representing functions with arguments in an abstract syntax tree malcolm@55bank.freeserve.co.uk (Malcolm) (2004-01-02)
Re: representing functions with arguments in an abstract syntax tree cfc@world.std.com (Chris F Clark) (2004-01-02)
Re: representing functions with arguments in an abstract syntax tree jacob@jacob.remcomp.fr (jacob navia) (2004-01-02)
Re: representing functions with arguments in an abstract syntax tree witness@t-online.de (Uli Kusterer) (2004-01-02)
| List of all articles for this month |

From: "jacob navia" <jacob@jacob.remcomp.fr>
Newsgroups: comp.compilers,comp.lang.c
Date: 2 Jan 2004 03:43:38 -0500
Organization: Wanadoo, l'internet avec France Telecom
References: 03-12-142
Keywords: code
Posted-Date: 02 Jan 2004 03:43:38 EST

Just do this:


typedef union _BuiltinUnion {
        int (*FunctionNoArgs)(void);
        Node *(Function1argReturnsNode)(Node *p);
        ...
        etc
        ...
} BUILTIN_UNION; // Uppercase looks ugly but, why not.


Then, in your code you write:


        u.FunctionNoArgs()
        or
        Node *a = u.Function1argReturnsNode(pNode);


Since the compiler has seen the prototypes, it will generate correctly
the
call.


Jacob Navia
http://www.cs.virginia.edu/~lcc-win32


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.