Aseba  1.5.5
Classes | Typedefs | Functions | Variables
AESL Compiler

Classes

struct  Aseba::TargetDescription
 Description of target VM. More...
 
struct  Aseba::BytecodeElement
 A bytecode element. More...
 
struct  Aseba::BytecodeVector
 Bytecode array in the form of a dequeue, for construction. More...
 
struct  Aseba::SourcePos
 Position in a source file or string. First is line, second is column. More...
 
class  Aseba::ErrorMessages
 Return error messages based on error ID (needed to translate messages for other applications) More...
 
struct  Aseba::Error
 Compilation error. More...
 
struct  Aseba::TranslatableError
 
struct  Aseba::NamedValue
 A name - value pair. More...
 
struct  Aseba::NamedValuesVector
 Generic vector of name - value pairs. More...
 
struct  Aseba::CommonDefinitions
 Definitions common to several nodes, such as events or some constants. More...
 
class  Aseba::Compiler
 Aseba Event Scripting Language compiler. More...
 
struct  Aseba::PreLinkBytecode
 Bytecode use for compilation previous to linking. More...
 
struct  Aseba::Node
 An abstract node of syntax tree. More...
 
struct  Aseba::BlockNode
 Node for L"block", i.e. a vector of statements. More...
 
struct  Aseba::ProgramNode
 Node for L"program", i.e. a block node with some special behaviour later on. More...
 
struct  Aseba::AssignmentNode
 Node for assignation. More...
 
struct  Aseba::IfWhenNode
 Node for L"if" and L"when". More...
 
struct  Aseba::FoldedIfWhenNode
 Node for L"if" and L"when" with operator folded inside. More...
 
struct  Aseba::WhileNode
 Node for L"while". More...
 
struct  Aseba::FoldedWhileNode
 Node for L"while" with operator folded inside. More...
 
struct  Aseba::EventDeclNode
 Node for L"onevent" no children. More...
 
struct  Aseba::EmitNode
 Node for L"emit". More...
 
struct  Aseba::SubDeclNode
 Node for L"sub" no children. More...
 
struct  Aseba::CallSubNode
 Node for L"callsub" no children. More...
 
struct  Aseba::BinaryArithmeticNode
 Node for binary arithmetic. More...
 
struct  Aseba::UnaryArithmeticNode
 Node for unary arithmetic children[0] is the expression to negate. More...
 
struct  Aseba::ImmediateNode
 Node for pushing immediate value on stack. More...
 
struct  Aseba::StoreNode
 Node for storing a variable from stack. More...
 
struct  Aseba::LoadNode
 Node for loading a variable on stack. More...
 
struct  Aseba::ArrayWriteNode
 Node for writing to an array. More...
 
struct  Aseba::ArrayReadNode
 Node for reading from an array. More...
 
struct  Aseba::LoadNativeArgNode
 Node for loading the address of the argument of a native function that is not known at compile time, but that does exist in memory. More...
 
struct  Aseba::CallNode
 Node for calling a native function may have children for pushing constants somewhere. More...
 
struct  Aseba::ReturnNode
 Node for returning from an event or subroutine has no children, just a jump of 0 offset that will be resolved at link time. More...
 
struct  Aseba::AbstractTreeNode
 Virtual class for abstraction nodes abort() if you try to typeCheck(), optimize() or emit() to force correct expansion into regular Aseba nodes. More...
 
struct  Aseba::TupleVectorNode
 Node for assembling values into an array children[x] is the x-th Node to be assembled. More...
 
struct  Aseba::MemoryVectorNode
 Node for accessing a memory as a vector, in read or write operations If write == true, will expand to StoreNode or ArrayWriteNode If write == false, will expand to LoadNode or ArrayReadNode children[0] is an optional index If children[0] is a TupleVectorNode of one elements (int), it will be foo[x] If children[0] is a TupleVectorNode of two elements (int), it will be foo[x:y] If children[0] is another type of node, it will be foo[whatever] If children[0] doesn't exist, access to the full array is considered. More...
 
struct  Aseba::ArithmeticAssignmentNode
 Node for operations like "vector (op)= something" Will expand to "vector = vector (op) something" children[0] is a MemoryVectorNode children[1] is whatever Node for the right operand. More...
 
struct  Aseba::UnaryArithmeticAssignmentNode
 Node for operations like "vector(op)", may be ++ or – Will expand to "vector (op)= [1,...,1]" children[0] is a MemoryVectorNode. More...
 

Typedefs

typedef std::map< std::wstring, std::pair< unsigned, unsigned > > Aseba::VariablesMap
 Lookup table for variables name => (pos, size))
 
typedef std::map< std::wstring, unsigned > Aseba::FunctionsMap
 Lookup table for functions (name => id in target description)
 
typedef std::vector< std::wstring > Aseba::VariablesNamesVector
 Vector of names of variables.
 
typedef NamedValue Aseba::EventDescription
 An event description is a name - value pair.
 
typedef NamedValue Aseba::ConstantDefinition
 An constant definition is a name - value pair.
 
typedef NamedValuesVector Aseba::EventsDescriptionsVector
 Vector of events descriptions.
 
typedef NamedValuesVector Aseba::ConstantsDefinitions
 Vector of constants definitions.
 
typedef std::vector< short int > Aseba::VariablesDataVector
 Vector of data of variables.
 

Functions

template<class T >
unsigned int Aseba::editDistance (const T &s1, const T &s2, const unsigned maxDist)
 Compute the edit distance between two vector-style containers, inspired from http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#C.2B.2B.
 
template<typename MapType >
MapType::const_iterator Aseba::findInTable (const MapType &map, const std::wstring &name, const SourcePos &pos, const ErrorCode notFoundError, const ErrorCode misspelledError)
 Helper function to find for something in one of the map, using edit-distance to check for candidates if not found.
 
template<typename T >
bool Aseba::isPOT (T number)
 Return true if number is a power of two.
 
template<typename T >
unsigned Aseba::shiftFromPOT (T number)
 If number is a power of two, number = (1 << shift) and this function returns shift, otherwise return value is undefined.
 
std::wstring Aseba::binaryOperatorToString (AsebaBinaryOperator op)
 Return the string corresponding to the binary operator.
 
std::wstring Aseba::unaryOperatorToString (AsebaUnaryOperator op)
 Return the string corresponding to the unary operator.
 
bool Aseba::Compiler::verifyStackCalls (PreLinkBytecode &preLinkBytecode)
 Verify that no call path can create a stack overflow.
 
uint16 Aseba::TargetDescription::crc () const
 Compute the XModem CRC of the description, as defined in AS001 at https://aseba.wikidot.com/asebaspecifications.
 
VariablesMap Aseba::TargetDescription::getVariablesMap (unsigned &freeVariableIndex) const
 Get a VariablesMap out of namedVariables, overwrite freeVariableIndex.
 
FunctionsMap Aseba::TargetDescription::getFunctionsMap () const
 Get a FunctionsMap out of nativeFunctions.
 
unsigned Aseba::BytecodeElement::getWordSize () const
 Return the number of words this element takes in memory.
 
 Aseba::Compiler::Compiler ()
 Constructor. You must setup a description using setTargetDescription() before any call to compile().
 
void Aseba::Compiler::setTargetDescription (const TargetDescription *description)
 Set the description of the target as returned by the microcontroller. You must call this function before any call to compile().
 
void Aseba::Compiler::setCommonDefinitions (const CommonDefinitions *definitions)
 Set the common definitions, such as events or some constants.
 
bool Aseba::Compiler::compile (std::wistream &source, BytecodeVector &bytecode, unsigned &allocatedVariablesCount, Error &errorDescription, std::wostream *dump=0)
 Compile a new condition. More...
 
bool Aseba::Compiler::link (const PreLinkBytecode &preLinkBytecode, BytecodeVector &bytecode)
 Create the final bytecode for a microcontroller.
 
void Aseba::BytecodeVector::changeStopToRetSub ()
 Change "stop" bytecode to "return from subroutine".
 
unsigned short Aseba::BytecodeVector::getTypeOfLast () const
 Return the type of last bytecode element.
 
EventAddressesToIdsMap Aseba::BytecodeVector::getEventAddressesToIds () const
 Get the map of event addresses to identifiers.
 
void Aseba::Compiler::disassemble (BytecodeVector &bytecode, const PreLinkBytecode &preLinkBytecode, std::wostream &dump) const
 Disassemble a microcontroller bytecode and dump it.
 
static const std::wstring Aseba::ErrorMessages::defaultCallback (ErrorCode error)
 Default callback.
 
std::wstring Aseba::Error::toWString () const
 Return a string describing the error. More...
 
 Aseba::TranslatableError::TranslatableError (const SourcePos &pos, ErrorCode error)
 
Error Aseba::TranslatableError::toError (void)
 
static void Aseba::TranslatableError::setTranslateCB (ErrorMessages::ErrorCallback newCB)
 
TranslatableError & Aseba::TranslatableError::arg (int value, int fieldWidth=0, int base=10, wchar_t fillChar= ' ')
 
TranslatableError & Aseba::TranslatableError::arg (long int value, int fieldWidth=0, int base=10, wchar_t fillChar= ' ')
 
TranslatableError & Aseba::TranslatableError::arg (unsigned value, int fieldWidth=0, int base=10, wchar_t fillChar= ' ')
 
TranslatableError & Aseba::TranslatableError::arg (float value, int fieldWidth=0, int precision=6, wchar_t fillChar= ' ')
 
TranslatableError & Aseba::TranslatableError::arg (const std::wstring &value)
 
std::wstring Aseba::SourcePos::toWString () const
 Return the string version of this position.
 
bool Aseba::NamedValuesVector::contains (const std::wstring &s, size_t *position=0) const
 Return whether a named-value vector contains a certain value, by iterating.
 
VariablesMap::const_iterator Aseba::Compiler::findVariable (const std::wstring &name, const SourcePos &pos) const
 Look for a variable of a given name, and if found, return an iterator; if not, return an exception.
 
FunctionsMap::const_iterator Aseba::Compiler::findFunction (const std::wstring &name, const SourcePos &pos) const
 Look for a function of a given name, and if found, return an iterator; if not, return an exception.
 
ConstantsMap::const_iterator Aseba::Compiler::findConstant (const std::wstring &name, const SourcePos &pos) const
 Look for a constant of a given name, and if found, return an iterator; if not, return an exception.
 
bool Aseba::Compiler::constantExists (const std::wstring &name) const
 Return true if a constant of a given name exists.
 
EventsMap::const_iterator Aseba::Compiler::findGlobalEvent (const std::wstring &name, const SourcePos &pos) const
 Look for a global event of a given name, and if found, return an iterator; if not, return an exception.
 
EventsMap::const_iterator Aseba::Compiler::findAnyEvent (const std::wstring &name, const SourcePos &pos) const
 
SubroutineReverseTable::const_iterator Aseba::Compiler::findSubroutine (const std::wstring &name, const SourcePos &pos) const
 Look for a subroutine of a given name, and if found, return an iterator; if not, return an exception.
 
void Aseba::Compiler::buildMaps ()
 Build variables and functions maps.
 
virtual Aseba::Node::~Node ()
 Destructor, delete all children.
 
virtual Node * Aseba::Node::deepCopy ()
 Return a deep copy of the object (children are also copied)
 
 Aseba::AssignmentNode::AssignmentNode (const SourcePos &sourcePos, Node *left, Node *right)
 Constructor.
 
 Aseba::EventDeclNode::EventDeclNode (const SourcePos &sourcePos, unsigned eventId=0)
 Constructor.
 
 Aseba::SubDeclNode::SubDeclNode (const SourcePos &sourcePos, unsigned subroutineId)
 Constructor.
 
 Aseba::CallSubNode::CallSubNode (const SourcePos &sourcePos, const std::wstring &subroutineName)
 Constructor.
 
 Aseba::BinaryArithmeticNode::BinaryArithmeticNode (const SourcePos &sourcePos, AsebaBinaryOperator op, Node *left, Node *right)
 Constructor.
 
static BinaryArithmeticNode * Aseba::BinaryArithmeticNode::fromComparison (const SourcePos &sourcePos, Compiler::Token::Type op, Node *left, Node *right)
 Create a binary arithmetic node for comparaison operation op.
 
static BinaryArithmeticNode * Aseba::BinaryArithmeticNode::fromShiftExpression (const SourcePos &sourcePos, Compiler::Token::Type op, Node *left, Node *right)
 Create a binary arithmetic node for shift operation op.
 
static BinaryArithmeticNode * Aseba::BinaryArithmeticNode::fromAddExpression (const SourcePos &sourcePos, Compiler::Token::Type op, Node *left, Node *right)
 Create a binary arithmetic node for add/sub operation op.
 
static BinaryArithmeticNode * Aseba::BinaryArithmeticNode::fromMultExpression (const SourcePos &sourcePos, Compiler::Token::Type op, Node *left, Node *right)
 Create a binary arithmetic node for mult/div/mod operation op.
 
static BinaryArithmeticNode * Aseba::BinaryArithmeticNode::fromBinaryExpression (const SourcePos &sourcePos, Compiler::Token::Type op, Node *left, Node *right)
 Create a binary arithmetic node for or/xor/and operation op.
 
 Aseba::UnaryArithmeticNode::UnaryArithmeticNode (const SourcePos &sourcePos, AsebaUnaryOperator op, Node *child)
 Constructor.
 
 Aseba::ArrayWriteNode::ArrayWriteNode (const SourcePos &sourcePos, unsigned arrayAddr, unsigned arraySize, const std::wstring &arrayName)
 Constructor.
 
 Aseba::ArrayReadNode::ArrayReadNode (const SourcePos &sourcePos, unsigned arrayAddr, unsigned arraySize, const std::wstring &arrayName)
 Constructor.
 
 Aseba::LoadNativeArgNode::LoadNativeArgNode (MemoryVectorNode *memoryNode, unsigned tempAddr)
 Constructor, delete the provided memoryNode.
 
 Aseba::MemoryVectorNode::MemoryVectorNode (const SourcePos &sourcePos, unsigned arrayAddr, unsigned arraySize, const std::wstring &arrayName)
 Constructor.
 
 Aseba::CallNode::CallNode (const SourcePos &sourcePos, unsigned funcId)
 Constructor.
 
 Aseba::ArithmeticAssignmentNode::ArithmeticAssignmentNode (const SourcePos &sourcePos, AsebaBinaryOperator op, Node *left, Node *right)
 Constructor.
 
static ArithmeticAssignmentNode * Aseba::ArithmeticAssignmentNode::fromArithmeticAssignmentToken (const SourcePos &sourcePos, Compiler::Token::Type token, Node *left, Node *right)
 
static AsebaBinaryOperator Aseba::ArithmeticAssignmentNode::getBinaryOperator (Compiler::Token::Type token)
 
 Aseba::UnaryArithmeticAssignmentNode::UnaryArithmeticAssignmentNode (const SourcePos &sourcePos, Compiler::Token::Type token, Node *memory)
 Constructor.
 
virtual void Aseba::Node::dump (std::wostream &dest, unsigned &indent) const
 Dump this node and the rest of the tree.
 
virtual void Aseba::TupleVectorNode::dump (std::wostream &dest, unsigned &indent) const
 Dump this node and the rest of the tree.
 
virtual std::wstring Aseba::IfWhenNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::FoldedIfWhenNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::WhileNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::FoldedWhileNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::EventDeclNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::EmitNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::SubDeclNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::CallSubNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::BinaryArithmeticNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::UnaryArithmeticNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::ImmediateNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::LoadNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::StoreNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::ArrayReadNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::ArrayWriteNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::LoadNativeArgNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::CallNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::TupleVectorNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::MemoryVectorNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::ArithmeticAssignmentNode::toWString () const
 Return a string representation of this node.
 
virtual std::wstring Aseba::UnaryArithmeticAssignmentNode::toWString () const
 Return a string representation of this node.
 
 Aseba::PreLinkBytecode::PreLinkBytecode ()
 Add init event and point to currentBytecode it.
 
void Aseba::PreLinkBytecode::fixup (const Compiler::SubroutineTable &subroutineTable)
 Fixup prelinked bytecodes by making sure that each vector is closed correctly, i.e. More...
 
virtual unsigned Aseba::Node::getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void Aseba::BlockNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::ProgramNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::AssignmentNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::IfWhenNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::FoldedIfWhenNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual unsigned Aseba::FoldedIfWhenNode::getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void Aseba::WhileNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::FoldedWhileNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual unsigned Aseba::FoldedWhileNode::getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void Aseba::EventDeclNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::EmitNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::SubDeclNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::CallSubNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::BinaryArithmeticNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual unsigned Aseba::BinaryArithmeticNode::getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void Aseba::UnaryArithmeticNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::ImmediateNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual unsigned Aseba::ImmediateNode::getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void Aseba::LoadNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual unsigned Aseba::LoadNode::getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void Aseba::StoreNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::ArrayWriteNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::ArrayReadNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual void Aseba::LoadNativeArgNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual unsigned Aseba::LoadNativeArgNode::getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void Aseba::CallNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual unsigned Aseba::CallNode::getStackDepth () const
 Return the stack depth requirement for this node and its children.
 
virtual void Aseba::ReturnNode::emit (PreLinkBytecode &bytecodes) const
 Generate bytecode.
 
virtual Node * Aseba::BlockNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::AssignmentNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::IfWhenNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::FoldedIfWhenNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::WhileNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::FoldedWhileNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::EventDeclNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::EmitNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::SubDeclNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::CallSubNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::BinaryArithmeticNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
void Aseba::BinaryArithmeticNode::deMorganNotRemoval ()
 Recursively apply de Morgan law as long as nodes are logic operations, and then invert comparisons.
 
virtual Node * Aseba::UnaryArithmeticNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::ImmediateNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::LoadNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::StoreNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::ArrayReadNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::ArrayWriteNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::LoadNativeArgNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
virtual Node * Aseba::CallNode::optimize (std::wostream *dump)
 Optimize this node, return the optimized node.
 
std::wstring Aseba::Node::typeName (const Node::ReturnType &type) const
 Return the name of a type.
 
void Aseba::Node::expectType (const Node::ReturnType &expected, const Node::ReturnType &type) const
 Check for a specific type, throw an exception otherwise.
 
virtual ReturnType Aseba::Node::typeCheck (Compiler *compiler)
 Typecheck this node, throw an exception if there is any type violation.
 
virtual ReturnType Aseba::AssignmentNode::typeCheck (Compiler *compiler)
 Typecheck this node, throw an exception if there is any type violation.
 
virtual ReturnType Aseba::IfWhenNode::typeCheck (Compiler *compiler)
 Typecheck this node, throw an exception if there is any type violation.
 
virtual ReturnType Aseba::WhileNode::typeCheck (Compiler *compiler)
 Typecheck this node, throw an exception if there is any type violation.
 
virtual ReturnType Aseba::CallSubNode::typeCheck (Compiler *compiler)
 Typecheck this node, throw an exception if there is any type violation.
 
virtual ReturnType Aseba::BinaryArithmeticNode::typeCheck (Compiler *compiler)
 Typecheck this node, throw an exception if there is any type violation.
 
virtual ReturnType Aseba::UnaryArithmeticNode::typeCheck (Compiler *compiler)
 Typecheck this node, throw an exception if there is any type violation.
 

Variables

static ErrorMessages::ErrorCallback Aseba::TranslatableError::translateCB = NULL
 
static const AsebaBinaryOperator Aseba::ArithmeticAssignmentNode::operatorMap []
 

Detailed Description

Function Documentation

bool Aseba::Compiler::compile ( std::wistream &  source,
BytecodeVector bytecode,
unsigned &  allocatedVariablesCount,
Error errorDescription,
std::wostream *  dump = 0 
)

Compile a new condition.

Parameters
sourcestream to read the source code from
bytecodedestination array for bytecode
allocatedVariablesCountamount of allocated variables
errorDescriptionerror is copied there on error
dumpstream to send dump messages to
Returns
returns true on success

References Aseba::PreLinkBytecode::fixup().

void Aseba::PreLinkBytecode::fixup ( const Compiler::SubroutineTable subroutineTable)

Fixup prelinked bytecodes by making sure that each vector is closed correctly, i.e.

with a STOP for events and a RET for subroutines

References AsebaBytecodeFromId, Aseba::BytecodeVector::changeStopToRetSub(), Aseba::PreLinkBytecode::events, Aseba::BytecodeVector::getTypeOfLast(), Aseba::BytecodeVector::lastLine, and Aseba::PreLinkBytecode::subroutines.

Referenced by Aseba::Compiler::compile().

std::wstring Aseba::Error::toWString ( ) const

Return a string describing the error.

Return the string version of this error.

Variable Documentation

const AsebaBinaryOperator Aseba::ArithmeticAssignmentNode::operatorMap
staticprotected
Initial value:
= {
ASEBA_OP_ADD,
ASEBA_OP_SUB,
ASEBA_OP_MULT,
ASEBA_OP_DIV,
ASEBA_OP_MOD,
ASEBA_OP_SHIFT_LEFT,
ASEBA_OP_SHIFT_RIGHT,
ASEBA_OP_BIT_OR,
ASEBA_OP_BIT_XOR,
ASEBA_OP_BIT_AND
}