Bob Rossi wrote: > > Thanks Brendon, that was really helpful. I'm very new at this, and may > have some seemingly rather odd questions. I see that global_namespace is > of type 'union tree_node'. Is this the C++ language dependent AST?
Yes, this is the C++ AST. I actually think it is just a superset of GENERIC. I.e. it uses a lot of stuff defined in the tree.def file but also has some stuff specific to C++ that is defined in the cp-tree.def file. >From what i have gathered ALL tree types use this "union tree" type to represent a node in the tree. A good place to start in the documentation is the GCC internals documentation: http://gcc.gnu.org/onlinedocs/gccint/ There is a section on: The intermediate representations used by the C and C++ front ends that describes a lot of useful information about the C++ front end tree. This C++ tree includes the nodes for the C tree also, so look in the files tree.def, cp-tree.def for documentation on the different types of nodes that can be found in this tree. In addition the file: tree.h contains a number of functions and macros that can be used for manipulating and checking the contents of tree nodes. A lot of this information is in the above documentation, but some things you just need to search the sources for. I find that if something doesn't have any documentation, i search the.c files for uses of it using grep and see how it is used to get some idea of what it does. Finally there is a lot of documentation in the source files. I just find it difficult searching for the correct macro/function to use to do what i want. Once I have found it, using it is not as big of an issue. Brendon.
