$search

Aseba::Node Struct Reference
[AESL Compiler]

An abstract node of syntax tree. More...

#include <tree.h>

Inheritance diagram for Aseba::Node:
Inheritance graph
[legend]

List of all members.

Public Types

enum  MemoryErrorCode { E_NOVAL = UINT_MAX }
typedef std::vector< Node * > NodesVector
 Vector for children of a node.
enum  ReturnType { TYPE_UNIT = 0, TYPE_BOOL, TYPE_INT }
 

A type a node can return.

More...

Public Member Functions

virtual void checkVectorSize () const
 Check the consistency in vectors' size.
virtual NodedeepCopy ()
 Return a deep copy of the object (children are also copied).
virtual void dump (std::wostream &dest, unsigned &indent) const
 Dump this node and the rest of the tree.
virtual void emit (PreLinkBytecode &bytecodes) const =0
 Generate bytecode.
virtual NodeexpandToAsebaTree (std::wostream *dump, unsigned int index=0)
 Second pass to expand "abstract" nodes into more concrete ones.
void expectType (const Node::ReturnType &expected, const Node::ReturnType &type) const
 Check for a specific type, throw an exception otherwise.
virtual unsigned getStackDepth () const
 Return the stack depth requirement for this node and its children.
virtual unsigned getVectorAddr () const
 return the address of the left-most operand, or E_NOVAL if none
virtual unsigned getVectorSize () const
 return the children's size, check for equal size, or E_NOVAL if no child
 Node (const SourcePos &sourcePos)
 Constructor.
virtual Nodeoptimize (std::wostream *dump)=0
 Optimize this node, return the optimized node.
virtual NodeshallowCopy ()=0
 Return a shallow copy of the object (children point to the same objects).
virtual std::wstring toNodeName () const =0
 Return a string representation of the name of this node.
virtual std::wstring toWString () const =0
 Return a string representation of this node.
virtual ReturnType typeCheck () const
 Typecheck this node, throw an exception if there is any type violation.
std::wstring typeName (const Node::ReturnType &type) const
 Return the name of a type.
virtual ~Node ()
 Destructor, delete all children.

Public Attributes

NodesVector children
 children of this node
SourcePos sourcePos
 position is source

Detailed Description

An abstract node of syntax tree.

Definition at line 46 of file tree.h.


Member Typedef Documentation

typedef std::vector<Node *> Aseba::Node::NodesVector

Vector for children of a node.

Definition at line 97 of file tree.h.


Member Enumeration Documentation

Enumerator:
E_NOVAL 

Definition at line 89 of file tree.h.

A type a node can return.

Enumerator:
TYPE_UNIT 
TYPE_BOOL 
TYPE_INT 

Definition at line 49 of file tree.h.


Constructor & Destructor Documentation

Aseba::Node::Node ( const SourcePos sourcePos  )  [inline]

Constructor.

Definition at line 57 of file tree.h.


Member Function Documentation

void Aseba::Node::checkVectorSize (  )  const [virtual]

Check the consistency in vectors' size.

Reimplemented in Aseba::AssignmentNode, Aseba::IfWhenNode, Aseba::FoldedIfWhenNode, Aseba::WhileNode, Aseba::FoldedWhileNode, and Aseba::ArithmeticAssignmentNode.

Definition at line 185 of file tree-expand.cpp.

virtual void Aseba::Node::emit ( PreLinkBytecode bytecodes  )  const [pure virtual]
Node * Aseba::Node::expandToAsebaTree ( std::wostream *  dump,
unsigned int  index = 0 
) [virtual]
unsigned Aseba::Node::getVectorAddr (  )  const [virtual]

return the address of the left-most operand, or E_NOVAL if none

Reimplemented in Aseba::StoreNode, Aseba::LoadNode, Aseba::ArrayWriteNode, Aseba::ArrayReadNode, and Aseba::MemoryVectorNode.

Definition at line 281 of file tree-expand.cpp.

unsigned Aseba::Node::getVectorSize (  )  const [virtual]

return the children's size, check for equal size, or E_NOVAL if no child

Reimplemented in Aseba::ImmediateNode, Aseba::StoreNode, Aseba::LoadNode, Aseba::ArrayWriteNode, Aseba::ArrayReadNode, Aseba::TupleVectorNode, and Aseba::MemoryVectorNode.

Definition at line 291 of file tree-expand.cpp.

virtual Node* Aseba::Node::optimize ( std::wostream *  dump  )  [pure virtual]
virtual Node* Aseba::Node::shallowCopy (  )  [pure virtual]
virtual std::wstring Aseba::Node::toNodeName (  )  const [pure virtual]
virtual std::wstring Aseba::Node::toWString (  )  const [pure virtual]

Member Data Documentation

children of this node

Definition at line 98 of file tree.h.

position is source

Definition at line 99 of file tree.h.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


aseba
Author(s): Stéphane Magnenat
autogenerated on Sat Mar 2 12:31:55 2013