MADARA  3.2.3
madara::expression Namespace Reference

Contains the KaRL expression tree interpreter and related classes. More...

Classes

class  Add
 Addition node of the parse tree. More...
 
class  And
 Logically and node of the parse tree. More...
 
class  ArrayRef
 Leaf node for an array reference. More...
 
class  Assignment
 Assign the value of an expression to a variable. More...
 
class  Both
 Evaluates both left and right children, regardless of values. More...
 
class  ClearVariable
 Clears a variable in the knowledge base. More...
 
class  ComponentNode
 An abstract base class defines a simple abstract implementation of an expression tree node. More...
 
class  CompositeAddNode
 A composite node that encompasses addition of two expressions. More...
 
class  CompositeAndNode
 A composite node that performs a logical and. More...
 
class  CompositeArrayReference
 Defines a terminal node of that references the current value stored in a variable. More...
 
class  CompositeAssignmentNode
 A composite node that allows for variable assignment. More...
 
class  CompositeBinaryNode
 Defines a left and right node (via inheritance from CompositeUnaryNode). More...
 
class  CompositeBothNode
 A composite node that evaluates both left and right expressions regardless of their evaluations. More...
 
class  CompositeConstArray
 A composite node that contains an array of values. More...
 
class  CompositeDivideNode
 A composite node that divides a left expression by a right one. More...
 
class  CompositeEqualityNode
 A composite node that compares left and right expressions for equality. More...
 
class  CompositeForLoop
 A composite node that iterates until a condition is met. More...
 
class  CompositeFunctionNode
 A composite node that calls a function. More...
 
class  CompositeGreaterThanEqualNode
 A composite node that compares left and right expressions for greater than or equal to. More...
 
class  CompositeGreaterThanNode
 A composite node that compares left and right children for greater than. More...
 
class  CompositeImpliesNode
 A composite node that performs an implication (inference rule) More...
 
class  CompositeInequalityNode
 A composite node that compares left and right children for inequality. More...
 
class  CompositeLessThanEqualNode
 A composite node that compares left and right children for less than or equal to. More...
 
class  CompositeLessThanNode
 A composite node that compares left and right children for less than. More...
 
class  CompositeModulusNode
 A composite node that divides a left expression by a right expression and returns the remainder of the division. More...
 
class  CompositeMultiplyNode
 A composite node that multiplies a left expression by a right expression. More...
 
class  CompositeNegateNode
 A composite node that integrally negates a right expression. More...
 
class  CompositeNotNode
 A composite node that logically nots a right expression. More...
 
class  CompositeOrNode
 A composite node that performs a logical or. More...
 
class  CompositePostdecrementNode
 A composite node that decrements a left expression. More...
 
class  CompositePostincrementNode
 A composite node that increments a right expression. More...
 
class  CompositePredecrementNode
 A composite node that decrements a right expression. More...
 
class  CompositePreincrementNode
 A composite node that increments a right expression. More...
 
class  CompositeReturnRightNode
 A composite node that evaluates both left and right expressions regardless of their evaluations. More...
 
class  CompositeSequentialNode
 A composite node that evaluates both left and right expressions regardless of their evaluations. More...
 
class  CompositeSquareRootNode
 A composite node that takes the square root of a term. More...
 
class  CompositeSubtractNode
 A composite node that encompasses subtraction of a right expression from a left expression. More...
 
class  CompositeTernaryNode
 
class  CompositeUnaryNode
 Encapsulates a single expression tree. More...
 
class  ConstArray
 A constant array that should not be changed. More...
 
class  Cos
 Returns the cosine of a term (radians) More...
 
class  DeleteVariable
 Deletes a variable from the knowledge base. More...
 
class  Divide
 Division node of the parse tree. More...
 
class  Equality
 Check and left and right arguments for equality. More...
 
class  Eval
 Evaluates a Knowledge Record and returns result. More...
 
class  ExpandEnv
 Expands a statement, e.g. More...
 
class  ExpandStatement
 Expands a statement, e.g. More...
 
class  ExpressionTree
 Encapsulates a MADARA KaRL expression into an evaluatable tree. More...
 
class  ExpressionTreeConstIterator
 Constant iterator over an expression tree. More...
 
class  ExpressionTreeIterator
 Non-const iterator for traversing an expression tree. More...
 
class  ExpressionTreeIteratorFactory
 Implementation of a factory pattern that dynamically allocates the appropriate ExpressionTreeIteratorImpl object. More...
 
class  ExpressionTreeIteratorImpl
 Implementation of the ExpressionTreeIterator pattern that is used to define the various iterations algorithms that can be performed to traverse the expression tree. More...
 
class  ForLoop
 Iterative looping node of the parse tree. More...
 
class  Fragment
 Fragment the Knowledge Record. More...
 
class  Function
 Function node of the parse tree. More...
 
class  GetClock
 Returns the clock of the argument or the system clock. More...
 
class  GetTime
 Returns the wall clock time. More...
 
class  GetTimeSeconds
 Returns the wall clock time in seconds. More...
 
class  GreaterThan
 Check and left and right arguments for greater than. More...
 
class  GreaterThanEqual
 Check and left and right arguments for greater than or equal to. More...
 
class  Implies
 Assign the value of an expression to a variable. More...
 
class  Inequality
 Check and left and right arguments for inequality. More...
 
class  InOrderIteratorImpl
 Iterates through an ExpressionTree in in-order. More...
 
class  Interpreter
 Parses incoming expression strings into a parse tree and generates an expression tree from the parse tree. More...
 
class  Isinf
 Returns whether the first argument is an infinite number. More...
 
class  KarlException
 An exception for unrecoverable KaRL compilation issues. More...
 
class  LeafNode
 Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. More...
 
class  LessThan
 Check and left and right arguments for less than. More...
 
class  LessThanEqual
 Check and left and right arguments for less than or equal to. More...
 
class  LevelOrderExpressionTreeIteratorImpl
 Iterates through an ExpressionTree in level-order. More...
 
class  List
 Parameter List. More...
 
class  ListNode
 Defines a terminal node that contains a list. More...
 
class  LogLevel
 Reads or sets the MADARA log level. More...
 
class  Modulus
 Modulus node of the parse tree (10 % 4 == 2) More...
 
class  Multiply
 Multiplication node of the parse tree. More...
 
class  Negate
 Negate node of the parse tree. More...
 
class  Not
 Logically not the right node. More...
 
class  Number
 Leaf node of parse tree. More...
 
class  Operator
 Abstract base class for all parse tree node operators. More...
 
class  Or
 Logically or node of the parse tree. More...
 
class  Postdecrement
 Postdecrement node of the parse tree. More...
 
class  Postincrement
 Postincrement node of the parse tree. More...
 
class  PostOrderIteratorImpl
 Iterates through an ExpressionTree in post-order. More...
 
class  Power
 Returns a base term taken to a power (exponent) More...
 
class  Predecrement
 Predecrement node of the parse tree. More...
 
class  Preincrement
 Preincrement node of the parse tree. More...
 
class  PreOrderIteratorImpl
 Iterates through an ExpressionTree in level-order. More...
 
class  Print
 Prints a Knowledge Record to the stderr. More...
 
class  PrintSystemCalls
 Prints a help menu for all system calls. More...
 
class  RandDouble
 Generates a random double. More...
 
class  RandInt
 Generates a random integer. More...
 
class  ReadFile
 Reads a file. More...
 
class  ReturnRight
 Evaluates both left and right children and returns right value. More...
 
class  Sequence
 Evaluates both left and right children, regardless of values. More...
 
class  SetClock
 Sets the system or a variable clock. More...
 
class  SetFixed
 Sets the output format to std::fixed. More...
 
class  SetPrecision
 Sets the precision of doubles. More...
 
class  SetScientific
 Sets the output to std::scientific. More...
 
class  Sin
 Returns the sin of a term (radians) More...
 
class  Size
 Returns the size of a record. More...
 
class  Sleep
 Sleeps for a certain amount of time. More...
 
class  SquareRoot
 Returns the square root of a term. More...
 
class  SquareRootUnary
 
class  Subtract
 Subtraction node of the parse tree. More...
 
class  Symbol
 Abstract base class of all parse tree nodes. More...
 
class  SystemCall
 Abstract base class for operators with 3+ potential subnodes. More...
 
class  SystemCallClearVariable
 Attempts to clear a variable. More...
 
class  SystemCallCos
 Returns the cosine of a term in radians. More...
 
class  SystemCallDeleteVariable
 Attempts to delete a variable. More...
 
class  SystemCallEval
 Evaluates a knowledge::KnowledgeRecord and returns the evaluation result. More...
 
class  SystemCallExpandEnv
 Returns the expansion of a statement with environment vars. More...
 
class  SystemCallExpandStatement
 Returns the expansion of a statement. More...
 
class  SystemCallFragment
 Returns a fragment of the knowledge record. More...
 
class  SystemCallGetClock
 Returns the system clock or a variable clock. More...
 
class  SystemCallGetTime
 Returns the time in nanoseconds since epoch. More...
 
class  SystemCallGetTimeSeconds
 Returns the current time in seconds since epoch. More...
 
class  SystemCallIsinf
 Returns the type of a specified knowledge record. More...
 
class  SystemCallLogLevel
 Sets or returns the current MADARA logging level. More...
 
class  SystemCallNode
 Interface for a MADARA system call. More...
 
class  SystemCallPow
 Calculates a base term taken to a power. More...
 
class  SystemCallPrint
 Prints a Knowledge Record. More...
 
class  SystemCallPrintSystemCalls
 Prints all supported system calls. More...
 
class  SystemCallRandDouble
 Returns a random double. More...
 
class  SystemCallRandInt
 Returns a random integer. More...
 
class  SystemCallReadFile
 Reads a file from an user-provided file name. More...
 
class  SystemCallSetClock
 Sets the system clock or a variable clock. More...
 
class  SystemCallSetFixed
 Sets the output format to use std::fixed. More...
 
class  SystemCallSetPrecision
 Sets the double precision for converting doubles to a string and for printing. More...
 
class  SystemCallSetScientific
 Sets the output format to use std::scientific. More...
 
class  SystemCallSin
 Returns the sin of a term in radians. More...
 
class  SystemCallSize
 Returns the size of a specified knowledge record. More...
 
class  SystemCallSleep
 Sleeps for a certain amount of time. More...
 
class  SystemCallSqrt
 Returns the square root of a term. More...
 
class  SystemCallTan
 Returns the tangent of a term in radians. More...
 
class  SystemCallToBuffer
 Converts an argument into an unsigned char buffer. More...
 
class  SystemCallToDouble
 Converts an argument to a double. More...
 
class  SystemCallToDoubles
 Converts an argument to an array of doubles. More...
 
class  SystemCallToHostDirs
 Ensures the directory delimiters are appropriate for the host operating system (e.g., on Windows, '\' and Linux, '/') More...
 
class  SystemCallToInteger
 Converts an argument to an integer. More...
 
class  SystemCallToIntegers
 Converts an argument to an array of integers. More...
 
class  SystemCallToString
 Converts an argument to a string. More...
 
class  SystemCallType
 Returns the type of a specified knowledge record. More...
 
class  SystemCallWriteFile
 Writes a knowledge record to an user-specified file name. More...
 
class  Tan
 Returns the tangent of a term (radians) More...
 
class  TernaryOperator
 Abstract base class for operators with 3+ potential subnodes. More...
 
class  ToBuffer
 Returns a buffer. More...
 
class  ToDouble
 Returns a double. More...
 
class  ToDoubles
 Returns a double array. More...
 
class  ToHostDirs
 Returns a version that has a directory structure appropriate to the OS. More...
 
class  ToInteger
 Returns an integer. More...
 
class  ToIntegers
 Returns an integers. More...
 
class  ToString
 Returns a string. More...
 
class  Type
 Returns the type of a record. More...
 
class  UnaryOperator
 Abstract base class for all parse tree node operators. More...
 
class  Variable
 Leaf node of parse tree. More...
 
class  VariableCompare
 Increment a variable by a certain amount. More...
 
class  VariableCompareNode
 Defines a terminal node of that references the current value stored in a variable. More...
 
class  VariableDecrement
 Decrement a variable by a certain amount. More...
 
class  VariableDecrementNode
 Composite node that subtracts a variable by some right hand side. More...
 
class  VariableDivide
 Divide a variable by a certain amount. More...
 
class  VariableDivideNode
 Composite node that divides a variable by some right hand side. More...
 
class  VariableExpander
 A convenience class for. More...
 
class  VariableIncrement
 Increment a variable by a certain amount. More...
 
class  VariableIncrementNode
 Defines a terminal node of that references the current value stored in a variable. More...
 
class  VariableMultiply
 Multiply a variable by a certain amount. More...
 
class  VariableMultiplyNode
 Composite node that multiplies a variable by some right hand side. More...
 
class  VariableNode
 Defines a terminal node of that references the current value stored in a variable. More...
 
class  Visitor
 Abstract base class for all visitors to all classes that derive from ComponentNode. More...
 
class  WriteFile
 Writes a file. More...
 

Typedefs

typedef std::deque< ComponentNode * > ComponentNodes
 a vector of Component Nodes More...
 
typedef std::map< std::string, ExpressionTreeExpressionTreeMap
 
typedef std::vector< Symbol * > Symbols
 
typedef std::map< std::string, std::string > SystemCallsHelp
 

Enumerations

enum  { EQUALITY_CHAR = 0-1, INEQUALITY_CHAR = 0-2, GREATER_THAN_EQUAL = 0-3, LESSER_THAN_EQUAL = 0-4 }
 
enum  {
  BOTH_PRECEDENCE = 1, IMPLIES_PRECEDENCE = 2, ASSIGNMENT_PRECEDENCE = 3, LOGICAL_PRECEDENCE = 4,
  CONDITIONAL_PRECEDENCE = 5, ADD_PRECEDENCE = 6, SUBTRACT_PRECEDENCE = 6, MULTIPLY_PRECEDENCE = 7,
  MODULUS_PRECEDENCE = 7, DIVIDE_PRECEDENCE = 7, NEGATE_PRECEDENCE = 8, NUMBER_PRECEDENCE = 9,
  VARIABLE_PRECEDENCE = 9, FUNCTION_PRECEDENCE = 9, FOR_LOOP_PRECEDENCE = 9, PARENTHESIS_PRECEDENCE = 10
}
 

Detailed Description

Contains the KaRL expression tree interpreter and related classes.

Typedef Documentation

a vector of Component Nodes

Definition at line 101 of file ComponentNode.h.

typedef std::map<std::string, ExpressionTree> madara::expression::ExpressionTreeMap

Definition at line 29 of file Interpreter.h.

typedef std::vector<Symbol *> madara::expression::Symbols

Definition at line 148 of file Interpreter.cpp.

typedef std::map<std::string, std::string> madara::expression::SystemCallsHelp

Definition at line 18 of file SystemCallPrintSystemCalls.h.

Enumeration Type Documentation

anonymous enum
Enumerator
EQUALITY_CHAR 
INEQUALITY_CHAR 
GREATER_THAN_EQUAL 
LESSER_THAN_EQUAL 

Definition at line 40 of file ExpressionTree.cpp.

anonymous enum
Enumerator
BOTH_PRECEDENCE 
IMPLIES_PRECEDENCE 
ASSIGNMENT_PRECEDENCE 
LOGICAL_PRECEDENCE 
CONDITIONAL_PRECEDENCE 
ADD_PRECEDENCE 
SUBTRACT_PRECEDENCE 
MULTIPLY_PRECEDENCE 
MODULUS_PRECEDENCE 
DIVIDE_PRECEDENCE 
NEGATE_PRECEDENCE 
NUMBER_PRECEDENCE 
VARIABLE_PRECEDENCE 
FUNCTION_PRECEDENCE 
FOR_LOOP_PRECEDENCE 
PARENTHESIS_PRECEDENCE 

Definition at line 93 of file Interpreter.cpp.