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