|parrotcode: base class for PAST and POST nodes|
|Contents | Compilers|
PCT::Node - base class for PAST and POST nodes
This file implements the base class for abstract syntax tree (PAST) and opcode syntax tree (POST) nodes in the Parrot Compiler Toolkit.
PCT::Node is the base class for all PAST and POST nodes.
It's derived from class
so that it has both array and hash components.
The array component is used to maintain a node's children,
while the hash component contains the attributes of the node.
In general we provide and use accessor methods for a node's attributes,
instead of accessing the hash component directly.
Every PAST/POST node has
name attribute is the node's name,
pos are used to identify the location in the original source code for the node.
pos values are generally set by the
node method below.
Other node attributes are generally defined by subclasses of
pushmethod, below) and calls the appropriate accessor method for each attribute. And returns the node.
childto the beginning of the invocant's list of children.
childto the end of the invocant's list of children.
class, initializes it with the given children and attributes, and adds it to the end of the invocant's array of children. Returns the newly created node.
posattributes to those of
valis another PAST node, then
posare simply copied from that node, otherwise
valis assumed to be a
Matchobject and obtains source/position information from that.
nameattribute of the invocant.
has_valueis true then set the invocant's value of
value. Returns the (resulting) value of
attrnamein the invocant.
fmtis provided, then it will be used as a prefix to the unique number.
Patrick Michaud <email@example.com> is the author and maintainer. Please send patches and suggestions to the Parrot porters or Perl 6 compilers mailing lists.
2006-11-20 Patrick Michaud added first draft of POD documentation. 2007-11-21 Re-implementation with pdd26 compliance, compiler toolkit 2007-12-07 Refactor PAST::Node into separate PCT::Node component.
Copyright (C) 2006-2008, The Perl Foundation.