compilers/ast/node.c - AST node handling


The AST (Abstract Syntax Tree) represents the code of a HLL source module.

Functions ^

int IMCC_find_node_nr(const char *name)

Returns the index in ast_list of the given node name or 0 if the node name doesn't exist.

nodeType *IMCC_new_const_node(Interp*, char *name, int set, YYLTYPE *loc)

Create a new Const node for the given constant name and Parrot register set set. Set may be:

  'I' ... Integer
  'N' ... Number
  'S' ... String
  'U' ... String treated as unicode string
  'P' ... PMCs (PMC constants aren't finished)
  'o' ... opcode name
nodeType *IMCC_new_var_node(Interp*, char *name, int set, YYLTYPE *loc)

Create a new variable node.

nodeType *IMCC_new_temp_node(Interp*, int set, YYLTYPE *loc)

Create a new temporary node.

nodeType *IMCC_new_node(Interp*, int nr, nodeType *child, YYLTYPE *loc)

Create a new node with node type number nr and the given child.

nodeType *IMCC_append_node(Interp *, nodeType *a, nodeType *b, YYLTYPE *loc)

Append node b add the end of a and return a.

IMCC_dump_nodes(nodeType *p)

Dump nodes to stdout

void IMCC_expand_nodes(Interp *interpreter, nodeType *p)

Create code for the passed node. The code is appended to the current unit's instructions.

void IMCC_free_nodes(Interp *interpreter, nodeType *p)

Free the nodes.


/* * Local variables: * c-indentation-style: bsd * c-basic-offset: 4 * indent-tabs-mode: nil * End: * * vim: expandtab shiftwidth=4: */