lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Antero Vipunen wrote:
Ahm. I don't think so. At least my old 3.2.3 gcc doesn't do that. But thank you for the idea.

It doesn't contain the code as source - it contains it as a decorated abstract syntax tree, as produced by the parser.

If you walk this tree you will find first definition nodes, which define things. These are chained together using the "chan" key value pair.

There are various types of node:

identifier_node, string_cst, integer_cst and const_decl all define constants of one sort or another. Their key/value pairs will describe the constant, i.e. it's name, what the constant is, what type it is (if applicable), &c.

type_decl, void_type, integer_type, real_type, boolean_type, enumeral_type, pointer_type, reference_type, array_type, record_type, union_type, function_type and method_type define types. Their key/value pairs will indicate their name, size, width, alignment, what type they point/refer/are an array of, a link to a tree_list of their member types and positions, &c.

var_decl defines a variable, primarily it's name and type.

namespace_decl defines a namespace.

A function_decl node may have a function body attached. This will be full of nodes with names ending in _expr. For the purposes of generating glue code, this is unneccessary. As such, you'll want to throw them away to save memory.

http://www.delorie.com/gnu/docs/gcc/gccint_31.html may help - it's a guide to the nodes from the inside, where they're macros, rather than from the outside, where they're entries in a file.

--
Lisa
http://www.thecommune.org.uk/~lisa/