|parsing C function declarations to generate code to serialize the form firstname.lastname@example.org (Moshe Pfeffer) (2006-12-14)|
|Re: parsing C function declarations to generate code to serialize the email@example.com (Eliot Miranda) (2006-12-14)|
|Re: parsing C function declarations to generate code to serialize the DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-12-14)|
|Re: parsing C function declarations to generate code to serialize the firstname.lastname@example.org (Alex McDonald) (2006-12-15)|
|Re: parsing C function declarations to generate code to serialize the email@example.com (Ira Baxter) (2006-12-24)|
|From:||Eliot Miranda <firstname.lastname@example.org>|
|Date:||14 Dec 2006 17:27:38 -0500|
Moshe Pfeffer wrote:
> I am looking for an elegant method to do the following. Are there
> tools available to help? Have you done something like this that I may
> also try?
> I wish to take a C header file consisting of a list of function
> declarations, parse the function declaration to obtain a
> representation of the formal parameters from which to generate C
> code. Each argument must be processable as a tree, since it may be a
> struct, or pointer to a struct, with further structs/pointer to
> structs as it's members, or member's members, etc. If it is a simple
> type, the tree has 1 node, and depth 1. If it is a pointer to a simple
> type, the tree has 2 nodes and depth 2 (one for the pointer and one
> for the data pointed to).
Every language platform that provides tools to automatically generate
interfaces to a given OS's ABI (since so many are implemented in C) do
this. But they may not do it in exactly the way you anticipate. For
example, these tools may generate machine code to perform argument
marshalling for call-outs and call-backs to/from C. They may include
implementations of platform-specific structure member alignment rules so
that structures are correct across OSs. They will probably include (or
use) a C preprocessor to correctly parse arbitrary header files.
I am familiar with such tools in the Smalltalk world where they're used
to interface Smalltalk virtual machines to some forms of external code.
But you'd find similar technologies in Lisp (CLOS), Java and other
The surest sign that intelligent life exists elsewhere in Calvin &
the universe is that none of it has tried to contact us. Hobbes.
Eliot ,,,^..^,,, Smalltalk - scene not herd
Return to the
Search the comp.compilers archives again.