HLVM API Documentation

AST Class Reference

AST Tree Root Class. More...

#include <AST.h>

Inheritance diagram for AST:

Inheritance graph
[legend]
List of all members.

Accessors

Mutators

Factories

Constructors

Public Types

Types

Public Member Functions

Iterators

Protected Attributes

Data

Detailed Description

AST Tree Root Class.

This class is used to hold or contain an Abstract Syntax Tree. It forms the root node of a multi-way tree of other nodes. As such, its parent node is null and this is only true of the AST node. AST provides a number of facilities for management of the tree as a whole. It also provides all the factory functions for creating AST nodes.

Definition at line 70 of file AST.h.


Member Typedef Documentation

typedef std::vector<Bundle*> BundleList
 

Definition at line 75 of file AST.h.

typedef BundleList::const_iterator const_iterator
 

Definition at line 77 of file AST.h.

typedef BundleList::iterator iterator
 

Definition at line 76 of file AST.h.


Constructor & Destructor Documentation

AST  )  [protected]
 

Definition at line 55 of file AST.cpp.

References Pool::create(), and AST::pool.

~AST  )  [protected]
 

Definition at line 61 of file AST.cpp.


Member Function Documentation

void addBundle Bundle b  )  [inline]
 

Definition at line 108 of file AST.h.

References AST::bundles.

const Bundle* back  )  const [inline]
 

Definition at line 128 of file AST.h.

References AST::bundles.

Bundle* back  )  [inline]
 

Definition at line 127 of file AST.h.

References AST::bundles.

const_iterator begin  )  const [inline]
 

Definition at line 120 of file AST.h.

References AST::bundles.

iterator begin  )  [inline]
 

Bundle Iteration.

Definition at line 119 of file AST.h.

References AST::bundles.

static bool classof const Node N  )  [inline, static]
 

Provide support for isa<X> and friends.

Reimplemented from Node.

Definition at line 99 of file AST.h.

References Node::is(), and hlvm::TreeTopID.

static bool classof const AST  )  [inline, static]
 

Provide support for isa<X> and friends.

Definition at line 98 of file AST.h.

AST * create  )  [static]
 

Definition at line 90 of file AST.cpp.

References AST::AST().

void destroy AST ast  )  [static]
 

Definition at line 96 of file AST.cpp.

References ast.

bool empty  )  const [inline]
 

Definition at line 124 of file AST.h.

References AST::bundles.

const_iterator end  )  const [inline]
 

Definition at line 122 of file AST.h.

References AST::bundles.

iterator end  )  [inline]
 

Definition at line 121 of file AST.h.

References AST::bundles.

const Bundle* front  )  const [inline]
 

Definition at line 126 of file AST.h.

References AST::bundles.

Bundle* front  )  [inline]
 

Definition at line 125 of file AST.h.

References AST::bundles.

Pool* getPool  )  const [inline]
 

Definition at line 96 of file AST.h.

References AST::pool.

const std::string& getPublicID  )  const [inline]
 

Definition at line 95 of file AST.h.

References AST::pubid.

const std::string& getSystemID  )  const [inline]
 

Definition at line 94 of file AST.h.

References AST::sysid.

void insertChild Node child  )  [protected, virtual]
 

Reimplemented from Node.

Definition at line 66 of file AST.cpp.

References AST::begin(), AST::bundles, AST::end(), and hlvmAssert.

AnyType * new_AnyType const std::string &  id,
Bundle bundle,
const Locator loc = 0
 

Create a new AnyType node. An AnyType node is a type that can hold a value of any other HLVM type.

Parameters:
id  The name of the type
bundle  The bundle to insert the type into
loc  The source locator

Definition at line 213 of file AST.cpp.

References bundle, Node::loc, Node::setLocator(), Type::setName(), and Node::setParent().

Argument * new_Argument const std::string &  name,
const Type Ty,
const Locator loc = 0
 

Create a new.

Parameters:
Ty  The argument name
loc  The type of the argument The source locator

Definition at line 675 of file AST.cpp.

References Node::loc, Node::setLocator(), Argument::setName(), and Value::setType().

ArrayType * new_ArrayType const std::string &  id,
Bundle bundle,
Type elemType,
uint64_t  maxSize,
const Locator loc = 0
 

Create a new ArrayType node. An ArrayType is a sequential arrangement of memory locations of uniform type. Arrays can be dynamically expanded or shrunk, but not beyond the maxSize parameter.

Parameters:
id  The name of the array type
bundle  The bundle to insert the type into
elemType  The element type
maxSize  The maximum number of elements in the array
loc  The source locator

Definition at line 321 of file AST.cpp.

References bundle, Node::loc, UniformContainerType::setElementType(), Node::setLocator(), ArrayType::setMaxSize(), Type::setName(), and Node::setParent().

AutoVarOp * new_AutoVarOp const std::string &  name,
const Type Ty,
const Locator loc
 

Create a new AutoVarOp. This one is a little unusual because it requires the user to know the type. Other operators can deduce the type from the operands.

Parameters:
name  Name of the autovar in its scope
Ty  Type of the autovar
loc  The source locator

Definition at line 741 of file AST.cpp.

References hlvmAssert, Node::loc, Node::setLocator(), AutoVarOp::setName(), and Value::setType().

Constant* new_BinaryCE NodeIDs  id,
Constant C1,
Constant C2,
const Locator loc = 0
 

Create a binary ConstantExpression Node.

Parameters:
id  The operator for the constant expression
C1  The first operand of the binary operator
C2  The second operand of the binary operator
loc  The source locator

template WriteOp * new_BinaryOp< WriteOp > const Type Ty,
Operator oprnd1,
Operator oprnd2,
const Locator loc = 0
[protected]
 

Provide a template function for creating a binary operator.

Parameters:
Ty  Result type of the operator
oprnd1  The first operand
oprnd2  The second operand
loc  The source locator

Definition at line 862 of file AST.cpp.

References hlvmAssert, and Node::loc.

WriteOp * new_BinaryOp< WriteOp > Operator oprnd1,
Operator oprnd2,
Bundle bundle,
const Locator loc = 0
 

Provide a template function for creating a binary operator.

Parameters:
oprnd1  The first operand
oprnd2  The second operand
bundle  The bundle, for type lookup
loc  The source locator

Definition at line 881 of file AST.cpp.

References Value::getType(), and Node::loc.

Block * new_Block const Locator loc  ) 
 

Create a new Block. You can also create Blocks with new_MulitOp<Block> interface. This one allows you to create the block before creating its content, for situations where that matters (like XML parsing).

Parameters:
loc  The source locator

Definition at line 733 of file AST.cpp.

References Node::loc, and Node::setLocator().

BooleanType * new_BooleanType const std::string &  id,
Bundle bundle,
const Locator loc = 0
 

Create a new BooleanType node. A BooleanType has a simple binary value, true or false.

Parameters:
id  The name of the type
bundle  The bundle to insert the type into
loc  The source locator

Definition at line 240 of file AST.cpp.

References bundle, Node::loc, Node::setLocator(), Type::setName(), and Node::setParent().

BufferType * new_BufferType const std::string &  id,
Bundle bundle,
const Locator loc = 0
 

Create a new BufferType node. A BufferType is a runtime type that is used to buffer input and output.

Parameters:
id  The name of the type
bundle  The bundle to insert the type into
loc  The source locator

Definition at line 253 of file AST.cpp.

References bundle, Node::loc, Node::setLocator(), Type::setName(), and Node::setParent().

Bundle * new_Bundle const std::string &  id,
const Locator loc = 0
 

Create a new Bundle node. A bundle is the general container of other AST nodes. Bundles are also the unit of loading and linking.

Parameters:
id  The name of the bundle
loc  The source locator

Definition at line 136 of file AST.cpp.

References Node::loc, Node::setLocator(), Bundle::setName(), and Node::setParent().

CharacterType * new_CharacterType const std::string &  id,
Bundle bundle,
const std::string &  enc,
const Locator loc = 0
 

Create a new CharacterType node. A CharacterType represents a single textual character in UTF-16 encoding.

Parameters:
id  The name of the type
bundle  The bundle to insert the type into
enc  The name of the encoding for the character
loc  The source locator

Definition at line 292 of file AST.cpp.

References bundle, Node::loc, Node::setLocator(), Type::setName(), and Node::setParent().

ConstantAny * new_ConstantAny const std::string &  name,
Bundle bundle,
const Type Ty,
ConstantValue val,
const Locator loc = 0
 

Createa new ConstantAny node.

Parameters:
name  The name of the constant
bundle  The bundle to insert the type into
Ty  The type for this constant
val  The value for the constant
loc  The source locator

Definition at line 429 of file AST.cpp.

References bundle, Node::loc, Node::setLocator(), Constant::setName(), Node::setParent(), and Value::setType().

ConstantArray * new_ConstantArray const std::string &  name,
Bundle bundle,
const ArrayType Ty,
const std::vector< ConstantValue * > &  elems,
const Locator loc = 0
 

Create a new ConstantArray node.

Parameters:
name  The name of the constant
bundle  The bundle to insert the type into
Ty  The type of the array
elems  The elements of the array
loc  The source locator

Definition at line 564 of file AST.cpp.

References ConstantAggregate::addConstant(), Node::loc, Node::setLocator(), and Constant::setName().

ConstantBoolean * new_ConstantBoolean const std::string &  name,
Bundle bundle,
const Type Ty,
bool  t_or_f,
const Locator loc = 0
 

Createa new ConstantBoolean node.

Parameters:
name  The name of the constant
bundle  The bundle to insert the type into
Ty  The type for this constant
t_or_f  The value for the constant
loc  The source locator

Definition at line 445 of file AST.cpp.

References bundle, Node::loc, Node::setLocator(), Constant::setName(), Node::setParent(), and Value::setType().

ConstantCharacter * new_ConstantCharacter const std::string &  name,
Bundle bundle,
const Type Ty,
const std::string &  val,
const Locator loc = 0
 

Createa new ConstantCharacter node.

Parameters:
name  The name of the constant
bundle  The bundle to insert the type into
Ty  The type for this constant
val  The value for the constant
loc  The source locator

Definition at line 461 of file AST.cpp.

References bundle, Node::loc, Node::setLocator(), Constant::setName(), Node::setParent(), and Value::setType().

ConstantContinuation * new_ConstantContinuation const std::string &  name,
Bundle bundle,
const ContinuationType Ty,
const std::vector< ConstantValue * > &  elems,
const Locator loc = 0
 

Create a new ConstantContinuation node.

Parameters:
name  The name of the constant
bundle  The bundle to insert the type into
Ty  The type of the array
elems  The elements of the array
loc  The source locator

Definition at line 634 of file AST.cpp.

References ConstantAggregate::addConstant(), DisparateContainerType::begin(), DisparateContainerType::end(), hlvmAssert, Node::loc, Node::setLocator(), Constant::setName(), and DisparateContainerType::size().

ConstantEnumerator * new_ConstantEnumerator const std::string &  name,
Bundle bundle,
const Type Ty,
const std::string &  val,
const Locator loc = 0
 

Createa new ConstantEnumerator node.

Parameters:
name  The name of the constant
bundle  The bundle to insert the type into
Ty  The type for this constant
val  The value for the constant
loc  The source locator

Definition at line 477 of file AST.cpp.

References bundle, Node::loc, Node::setLocator(), Constant::setName(), Node::setParent(), and Value::setType().

ConstantInteger * new_ConstantInteger const std::string &  name,
Bundle bundle,
const Type Ty,
const std::string &  val,
uint16_t  base,
const Locator loc = 0
 

Create a new ConstantInteger node.

Parameters:
name  The name of the constant
bundle  The bundle to insert the type into
Ty  The type for this constant
val  The value of the ConstantInteger
base  The numeric base the value is encoded in
loc  The source locator

Definition at line 494 of file AST.cpp.

References bundle, Node::loc, ConstantInteger::setBase(), Node::setLocator(), Constant::setName(), Node::setParent(), Value::setType(), and ConstantInteger::setValue().

ConstantPointer * new_ConstantPointer const std::string &  name,
Bundle bundle,
const Type type,
Constant referent,
const Locator loc = 0