c99AST - c99 abstract syntax tree


This file implements the various abstract syntax tree nodes for compiling c99 programs.

c99AST Node types ^

c99AST::Node ^

c99AST::Node is the base class for all c99AST nodes, and is derived from PCT::Node. A node has an array component to hold its children, and a hash component for its attributes. However, we tend to use accessor methods for accessing the node's attributes instead of accessing the hash directly.

Every c99AST node inherits name, source, and pos attributes from PCT::Node. The name attribute is the node's name, if any, while source and pos are used to identify the location in the original source code for the node. The source and pos values are generally set by the node method inherited from PCT::Node.

Other node attributes are generally defined by subclasses of c99AST::Node.


Accessor method -- sets/returns the return type for the invocant.


Accessor method -- sets/returns the arity (number of expected arguments) for the node.


Accessor method -- for named arguments, sets/returns the name to be associated with the argument.


Accessor method -- sets/returns the "flatten" flag on arguments.

c99AST::TypeDef ^

c99AST::Val nodes represent constant values in the abstract syntax tree. The name attribute represents the value of the node.


Get/set the constant value for this node.

c99AST::Var ^

c99AST::Var nodes represent variables within the abstract syntax tree. The variable name (if any) is given as the node's name attribute.


Get/set the c99AST::Var node's "scope" (i.e., how the variable is accessed or set). Allowable values include "package", "lexical", "parameter", and "keyed", representing HLL global, lexical, block parameter, and array/hash variables respectively.


Get/set the node's isdecl attribute (for lexical variables) to flag. A true value of isdecl indicates that the variable given by this node is to be created within the current lexical scope. Otherwise, the node refers to a lexical variable from an outer scope.


Get/set the lvalue attribute, which indicates whether this variable is being used in an lvalue context.


Get/set the variable's namespace attribute to the array of strings given by namespace. Useful only for variables with a scope of 'package'.


Get/set the node's slurpy attribute (for parameter variables) to flag. A true value of slurpy indicates that the parameter variable given by this node is to be created as a slurpy parameter (consuming all remaining arguments passed in).


If the variable needs to be instantiated, then type indicates either the type of the value to create for the node or (future implementation) a c99AST tree to create the value.


For keyed nodes, type indicates the type of aggregate to create for the base if the base doesn't specify its own 'viviself' attribute.

c99AST::Op ^

c99AST::Op nodes represent the operations in an abstract syntax tree. The primary function of the node is given by its pasttype, secondary functions may be given by the node's name, pirop, or other attributes.



Copyright (C) 2006-2008, The Perl Foundation.