NAME ^

NCIGENAST - NCIGEN abstract syntax tree

DESCRIPTION ^

This file implements the various abstract syntax tree nodes for doing syntax analysis on c99 programs.

NCIGENAST Node types ^

NCIGENAST::Node ^

NCIGENAST::Node is the base class for all NCIGENAST 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 NCIGENAST 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 NCIGENAST::Node.

returns([value])
Accessor method -- sets/returns the return type for the invocant.
arity([value])
Accessor method -- sets/returns the arity (number of expected arguments) for the node.
named([value])
Accessor method -- for named arguments, sets/returns the name to be associated with the argument.
flat([value]
Accessor method -- sets/returns the "flatten" flag on arguments.

NCIGENAST::TypeDef ^

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

value([value])
Get/set the constant value for this node.

NCIGENAST::Var ^

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

scope([value])
Get/set the NCIGENAST::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.
isdecl([flag])
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.
lvalue([flag])
Get/set the lvalue attribute, which indicates whether this variable is being used in an lvalue context.
namespace([namespace])
Get/set the variable's namespace attribute to the array of strings given by namespace. Useful only for variables with a scope of 'package'.
slurpy([flag])
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).
viviself([type])
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 NCIGENAST tree to create the value.
vivibase([type])
For keyed nodes, type indicates the type of aggregate to create for the base if the base doesn't specify its own 'viviself' attribute.

NCIGENAST::Op ^

NCIGENAST::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.

HISTORY ^

COPYRIGHT ^

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


parrot