Go to the previous, next section.

Defining Variables and Generating New Type Definitions

Generating New Type Definitions

The parse_type function parses a C-like type definition to create the corresponding type_node. Existing type definitions can be used to define the new type by including those definitions in the function call. In the parsed string the token "%%" is replaced by the next type definition from the argument list (just like printf).

     type_node * parse_type(char *, 
                            type_node * tn0=NULL, type_node * tn1=NULL,
                            type_node * tn2=NULL, type_node * tn3=NULL,
                            type_node * tn4=NULL, type_node * tn5=NULL,
                            type_node * tn6=NULL, type_node * tn7=NULL,
                            type_node * tn8=NULL, type_node * tn9=NULL)

     type_node * parse_type(base_symtab * st,
                            char *, 
                            type_node * tn0=NULL, type_node * tn1=NULL,
                            type_node * tn2=NULL, type_node * tn3=NULL,
                            type_node * tn4=NULL, type_node * tn5=NULL,
                            type_node * tn6=NULL, type_node * tn7=NULL,
                            type_node * tn8=NULL, type_node * tn9=NULL)



Defining Variables

A new variable is created using a new_sym function. The type of the variable is determined by using either a type_node, if_type, or a const_type (in builder_internals.h). If the optional name field is not used, a unique name is assigned by the builder.

     block & new_sym(const_type tp);
     block & new_sym(const_type tp, 
                     char * nm)
     block & new_sym(type_node * tp, 
                     char * nm)
     block & new_sym(char * parse_tp, 
                     char * nm)

     sym_node * get_sym()

     block & new_label(char *nm) 
     block & new_label(label_sym *ls) 










Go to the previous, next section.