1 #ifndef _INTERPRETER_CPP_ 2 #define _INTERPRETER_CPP_ 4 #ifndef _MADARA_NO_KARL_ 258 virtual ~
Eval (
void);
340 virtual ~
Print (
void);
424 virtual ~
Power (
void);
566 virtual ~
Size (
void);
787 virtual ~
Sleep (
void);
807 virtual ~
Type (
void);
1154 Symbol * rhs,
int compare_type,
1196 virtual ~
List (
void);
1244 virtual ~
Add (
void);
1265 virtual ~
And (
void);
1309 virtual ~
Both (
void);
1763 virtual ~
Not (
void);
1861 :
Symbol (logger, left, right, precedence)
1873 :
Operator (logger, left, right, precedence)
1886 :
madara::expression::
Symbol (logger, 0, right, precedence)
3007 precondition_ (precondition), condition_ (condition),
3008 postcondition_ (postcondition), body_ (body),
context_ (context)
3173 ++i, right = next->
right_, next = dynamic_cast <
Not *> (next->
right_)) {}
3211 key_ (key), context_ (context)
3400 compare_type_ (compare_type),
context_ (context)
3490 for (; next; next = dynamic_cast <
Add *> (left))
3510 nodes_.push_front (left->build ());
3566 for (; next; next = dynamic_cast <
And *> (left))
3586 nodes_.push_front (left->build ());
3634 Or * next = dynamic_cast <
Or *> (
left_);
3642 for (; next; next = dynamic_cast <
Or *> (left))
3662 nodes_.push_front (left->build ());
3721 for (; next; next = dynamic_cast <
Both *> (left))
3741 nodes_.push_front (left->build ());
3750 for (; next; next = dynamic_cast <
Both *> (right))
3770 nodes_.push_back (right->build ());
3829 for (; next; next = dynamic_cast <
ReturnRight *> (left))
3849 nodes_.push_front (left->build ());
3858 for (; next; next = dynamic_cast <
ReturnRight *> (right))
3878 nodes_.push_back (right->build ());
3936 for (; next; next = dynamic_cast <
Sequence *> (left))
3956 nodes_.push_front (left->build ());
3965 for (; next; next = dynamic_cast <
Sequence *> (right))
3985 nodes_.push_back (right->build ());
4373 std::string::size_type &i,
4374 int & accumulated_precedence,
4375 ::std::list<Symbol *>& list,
4376 Symbol *& returnableInput)
4378 ::std::list <Symbol *> substr_list;
4379 Symbol * lastValidInput (0);
4380 std::string::size_type begin = i;
4382 Symbol * body (0), *user_pre (0), *user_cond (0), *user_post (0);
4385 std::string::size_type count (0);
4389 variable =
".MADARA_I";
4391 bool delimiter_found =
false, handled =
false, equal_to =
false;
4392 std::string::size_type delimiter_begin = 0;
4393 std::string::size_type delimiter_end = 0;
4394 int paren_depth = 0;
4395 int index_depth = 0;
4398 for (; i < input.length (); ++i)
4400 if (index_depth == 0 && paren_depth == 0 &&
4401 input[i] ==
'-' && !delimiter_found)
4403 delimiter_found =
true;
4404 delimiter_begin = i;
4406 else if (index_depth == 0 && paren_depth == 0 &&
4407 delimiter_found && input[i] ==
'>')
4411 else if (input[i] ==
']')
4413 if (index_depth == 0 && paren_depth == 0)
4422 else if (input[i] ==
'(')
4426 else if (input[i] ==
'[')
4430 else if (input[i] ==
')')
4432 if (paren_depth == 0)
4447 if (delimiter_found && delimiter_end == 0)
4449 delimiter_found =
false;
4453 if (!delimiter_found)
4457 substr = input.substr (begin, i - begin);
4459 Symbol * index =
nullptr;
4462 count < substr.length ();)
4464 main_loop (context, substr, count, lastValidInput,
4465 handled, accumulated_precedence, substr_list);
4469 "KaRL: For loop: Array reference created at %s\n",
4473 if (!substr_list.empty ())
4475 index = substr_list.back ();
4476 substr_list.clear ();
4483 if (i + 2 < input.size ())
4485 if (input[i + 1] ==
'+' && input[i + 2] ==
'+')
4493 else if (input[i + 1] ==
'-' && input[i + 2] ==
'-')
4503 lastValidInput = op;
4505 precedence_insert (context, op, list);
4507 returnableInput = op;
4513 "KaRL: For loop: Within input string, the for loop delimiter begins at %d" 4514 " and ends at %d (should be at least 1). Loop construct begins at " 4515 "%d and ends at %d\n",
4516 (int)delimiter_begin, (
int)delimiter_end, (int)begin, (
int)i);
4520 if (input[i] ==
']')
4522 else if (input[i] !=
')')
4527 "KARL COMPILE ERROR:: No closing delimiter (']' or ')')" 4528 " has been specified on the for loop.\n");
4532 std::string::size_type end = i;
4540 if (delimiter_found)
4543 if (delimiter_begin - begin > 0)
4546 substr = input.substr (begin, delimiter_begin - begin);
4549 count < substr.length ();)
4551 main_loop (context, substr, count, lastValidInput,
4552 handled, accumulated_precedence, substr_list);
4556 "KaRL: For loop: Precondition is set to %s\n", substr.c_str ());
4559 if (!substr_list.empty ())
4561 user_pre = substr_list.back ();
4562 substr_list.clear ();
4568 "KaRL: For loop: No loop precondition was specified\n");
4572 if (delimiter_end - delimiter_begin > 1)
4576 substr = input.substr (delimiter_begin + 1, delimiter_end - (delimiter_begin + 1));
4579 count < substr.length ();)
4581 main_loop (context, substr, count, lastValidInput,
4582 handled, accumulated_precedence, substr_list);
4586 "KaRL: For loop: Postcondition is set to %s\n", substr.c_str ());
4589 if (!substr_list.empty ())
4591 user_post = substr_list.back ();
4593 substr_list.clear ();
4599 "KaRL: For loop: No loop special increment was specified\n");
4603 if (i - delimiter_end >= 2)
4606 substr = input.substr (delimiter_end + 1, i - (delimiter_end + 1));
4609 count < substr.length ();)
4611 main_loop (context, substr, count, lastValidInput,
4612 handled, accumulated_precedence, substr_list);
4616 if (!substr_list.empty ())
4619 "KaRL: For loop: Condition is set to %s\n", substr.c_str ());
4621 user_cond = substr_list.back ();
4622 substr_list.clear ();
4627 "KaRL: For loop: Condition was not set to %s\n", substr.c_str ());
4633 "KaRL: For loop: No loop condition was specified\n");
4640 substr = input.substr (begin, i - begin);
4643 count < substr.length ();)
4645 main_loop (context, substr, count, lastValidInput,
4646 handled, accumulated_precedence, substr_list);
4650 "KaRL: For loop: Condition only is set to %s\n", substr.c_str ());
4653 if (!substr_list.empty ())
4655 user_cond = substr_list.back ();
4656 substr_list.clear ();
4680 "KaRL: For loop: Postcondition is set to 1 (def)\n");
4684 for (++i; i < input.length () && is_whitespace (input[i]); ++i);
4687 if (i < input.length () && input[i] ==
'(')
4693 "KaRL: For loop: Body is reading from %s\n",
4694 input.substr (i, input.size () - i).c_str ());
4698 handle_parenthesis (context, input, i, lastValidInput, handled,
4699 accumulated_precedence, substr_list);
4701 if (!substr_list.empty ())
4703 body = substr_list.back ();
4704 substr_list.clear ();
4717 if (variable_node && number)
4720 "KaRL: For loop: Body is a simple assignment of variable %s to %s\n",
4721 variable_node->
key_.c_str (), number->item_.to_string ().c_str ());
4726 "KaRL: For loop: For loop has a complex body\n");
4730 precondition->
right_ = user_pre;
4738 post_val = number->
item_;
4744 number = dynamic_cast <
Number *> (user_cond);
4747 cond_val = number->
item_;
4752 int compare_type (0);
4760 user_post, context);
4764 user_cond, compare_type, context);
4767 Symbol * op =
new ForLoop (precondition, condition, postcondition, body, context);
4770 precedence_insert (context, op, list);
4800 delete precondition->
right_;
4801 precondition->
right_ = user_cond;
4804 precedence_insert (context, precondition, list);
4815 std::string::size_type &i,
4816 int & accumulated_precedence,
4817 ::std::list<Symbol *>& list,
4818 Symbol *& lastValidInput)
4821 std::string::size_type j = 1;
4823 for (; i + j < input.length () && is_alphanumeric (input[i + j]); ++j)
4834 for (; i < input.length () && is_whitespace (input[i]); ++i);
4836 if (i < input.length () && input[i] ==
'(')
4840 function->add_precedence (accumulated_precedence);
4842 bool handled =
false;
4844 ::std::list<Symbol *> param_list;
4846 int local_precedence = 0;
4847 Symbol * local_last_valid = 0;
4852 handle_parenthesis (context, input, i, local_last_valid, handled,
4853 local_precedence, param_list,
true);
4858 function->nodes_.resize (param_list.size ());
4861 for (::std::list<Symbol *>::iterator arg = param_list.begin ();
4862 arg != param_list.end (); ++arg, ++cur)
4864 function->nodes_[cur] = (*arg)->build ();
4869 precedence_insert (context,
function, list);
4872 else if (i < input.length () && input[i] ==
'[')
4875 handle_for_loop (context, name, input, i, accumulated_precedence,
4876 list, lastValidInput);
4884 if (i + 1 < input.size ())
4886 if (input[i] ==
'+' && input[i + 1] ==
'+')
4894 else if (input[i] ==
'-' && input[i + 1] ==
'-')
4904 lastValidInput = op;
4906 precedence_insert (context, op, list);
4916 std::string::size_type &i,
int & accumulated_precedence,
4917 ::std::list<madara::expression::Symbol *>& list,
4920 std::string::size_type j = 0;
4923 for (; i + j < input.length (); ++j)
4925 if (input[i + j] == opener && input[i + j - 1] !=
'\\')
4933 lastValidInput = number;
4939 precedence_insert (context, number, list);
4947 std::string::size_type &i,
4948 int & accumulated_precedence,
4949 ::std::list<Symbol *>& list,
4950 Symbol *& lastValidInput)
4953 std::string::size_type j = 1;
4955 for (; i + j < input.length () && is_alphanumeric (input[i + j]); ++j)
4970 for (; i < input.length () && is_whitespace (input[i]); ++i);
4976 if (i < input.length () && input[i] ==
'(')
4980 char first_char = 0;
4982 if (name.size () > 1)
4984 first_char = name[1];
4990 if (name ==
"#buffer")
4996 if (name ==
"#clear_var" || name ==
"#clear_variable")
5000 else if (name ==
"#cos")
5002 call =
new Cos (context);
5006 if (name ==
"#delete_var" || name ==
"#delete_variable")
5010 else if (name ==
"#double")
5014 else if (name ==
"#doubles")
5020 if (name ==
"#eval" || name ==
"#evaluate")
5022 call =
new Eval (context);
5024 else if (name ==
"#expand" || name ==
"#expand_statement")
5028 else if (name ==
"#expand_env" || name ==
"#expand_envs")
5034 if (name ==
"#fragment")
5038 else if (name ==
"#fixed")
5044 if (name ==
"#get_clock")
5048 else if (name ==
"#get_time" || name ==
"#get_time_ns" || name ==
"#get_time_nano")
5052 else if (name ==
"#get_time_seconds" || name ==
"#get_time_s")
5058 if (name ==
"#integer")
5062 else if (name ==
"#integers")
5068 if (name ==
"#log_level")
5076 call =
new Power (context);
5078 else if (name ==
"#print")
5080 call =
new Print (context);
5082 else if (name ==
"#print_system_calls" || name ==
"#print_system_call")
5086 else if (name ==
"#precision")
5092 if (name ==
"#rand_double")
5096 else if (name ==
"#rand_int" || name ==
"#rand_integer")
5100 else if (name ==
"#read_file")
5106 if (name ==
"#scientific")
5110 else if (name ==
"#set_clock")
5114 else if (name ==
"#set_fixed")
5118 else if (name ==
"#set_precision")
5122 else if (name ==
"#set_scientific")
5126 else if (name ==
"#sin")
5128 call =
new Sin (context);
5130 else if (name ==
"#size")
5132 call =
new Size (context);
5134 else if (name ==
"#sleep")
5136 call =
new Sleep (context);
5138 else if (name ==
"#sqrt")
5142 else if (name ==
"#string")
5150 call =
new Tan (context);
5152 else if (name ==
"#to_buffer")
5156 else if (name ==
"#to_double")
5160 else if (name ==
"#to_doubles")
5164 else if (name ==
"#to_host_dirs")
5168 else if (name ==
"#to_integer")
5172 else if (name ==
"#to_integers")
5176 else if (name ==
"#to_string")
5180 else if (name ==
"#type")
5182 call =
new Type (context);
5186 if (name ==
"#write_file")
5193 "System call %s is unsupported in this version of MADARA, " 5194 "defaulting to print_system_calls help menu.\n", name.c_str ());
5201 bool handled =
false;
5203 ::std::list<Symbol *> param_list;
5208 handle_parenthesis (context, input, i, lastValidInput, handled,
5209 accumulated_precedence, param_list,
true);
5211 call->
nodes_.resize (param_list.size ());
5214 for (::std::list<Symbol *>::iterator arg = param_list.begin ();
5215 arg != param_list.end (); ++arg, ++cur)
5217 call->
nodes_[cur] = (*arg)->build ();
5220 precedence_insert (context, call, list);
5226 "System call %s does not have appropriate parentheses\n", name.c_str ());
5235 std::string::size_type &i,
5236 int & accumulated_precedence,
5237 ::std::list<madara::expression::Symbol *>& list,
5244 std::string::size_type j = 1;
5247 for (; i + j <= input.length () && is_number (input[i + j]); ++j)
5251 if (i + j <= input.length () && input[i + j] ==
'.')
5254 for (; i + j <= input.length () && is_number (input[i + j]); ++j)
5258 if (i + j <= input.length () &&
5259 (input[i + j] ==
'e' || input[i + j] ==
'E'))
5262 if (i + j <= input.length () &&
5263 (input[i + j] ==
'+' || input[i + j] ==
'-'))
5268 for (; i + j <= input.length () && is_number (input[i + j]); ++j)
5274 std::stringstream buffer;
5275 buffer << input.substr (i, j);
5276 buffer >> new_number;
5286 std::stringstream buffer;
5287 buffer << input.substr (i, j);
5288 buffer >> new_number;
5295 lastValidInput = number;
5301 precedence_insert (context, number, list);
5310 ::std::list<madara::expression::Symbol *>& list)
5316 Symbol *parent = list.back ();
5330 for (child = parent->
right_;
5334 grandparent = parent;
5340 if (op_assignment || op_implies || op_unary)
5350 for (child = parent->
right_;
5354 grandparent = parent;
5365 (op_assignment || op_implies || op_unary)))
5376 if (parent_binary && !parent->
left_)
5379 Both * parent_both = dynamic_cast <
Both *> (parent);
5383 "KARL COMPILE WARNING: Empty statements between ';' may" 5384 " cause slower execution, attempting to prune away the extra " 5390 "KARL COMPILE WARNING: Binary operation has no left child. " 5391 "Inserting a zero\n");
5401 if (parent_unary && parent->
left_)
5404 "KARL COMPILE ERROR: Unary operation shouldn't have a left child\n");
5419 "KARL COMPILE ERROR: unary operation shouldn't have a left child\n");
5438 grandparent->
right_ = op;
5442 list.push_back (op);
5448 list.push_back (op);
5455 const std::string &input, std::string::size_type &i,
5457 bool & handled,
int & accumulated_precedence,
5458 ::std::list<madara::expression::Symbol *>& list,
5459 bool build_argument_list)
5462 if (is_number (input[i]))
5466 number_insert (context, input, i, accumulated_precedence,
5467 list, lastValidInput);
5469 else if (is_alphanumeric (input[i]))
5473 variable_insert (context, input, i, accumulated_precedence,
5474 list, lastValidInput);
5476 else if (is_string_literal (input[i]))
5478 char opener = input[i];
5482 string_insert (opener, context, input, i, accumulated_precedence,
5483 list, lastValidInput);
5485 else if (i < input.length () && input[i] ==
'[')
5489 object->add_precedence (accumulated_precedence);
5491 bool handled =
false;
5493 ::std::list<Symbol *> param_list;
5495 int local_precedence = 0;
5496 Symbol * local_last_valid = 0;
5501 handle_array (context, input, i, local_last_valid, handled,
5502 local_precedence, param_list);
5504 object->nodes_.resize (param_list.size ());
5507 for (::std::list<Symbol *>::iterator arg = param_list.begin ();
5508 arg != param_list.end (); ++arg, ++cur)
5510 object->nodes_[cur] = (*arg)->build ();
5513 precedence_insert (context,
object, list);
5516 else if (input[i] ==
'#')
5520 system_call_insert (context, input, i, accumulated_precedence,
5521 list, lastValidInput);
5523 else if (input[i] ==
'+')
5529 if (i + 1 < input.size () && input[i + 1] ==
'+')
5535 else if (i + 1 < input.size () && input[i + 1] ==
'=')
5539 if (var || array_ref)
5549 "KARL COMPILE WARNING (+=): " 5550 "Assignments must have a variable left hand side. Using .MADARA_I by " 5551 "default, but this is likely a major error in the expression.\n");
5561 precedence_insert (context, op, list);
5564 else if (input[i] ==
'-')
5570 if (i + 1 < input.size () && input[i + 1] ==
'-')
5576 else if (i + 1 < input.size () && input[i + 1] ==
'=')
5580 if (var || array_ref)
5592 "KARL COMPILE WARNING (-=): " 5593 "Assignments must have a variable left hand side. Using .MADARA_I by " 5594 "default, but this is likely a major error in the expression.\n");
5599 else if (!lastValidInput)
5608 precedence_insert (context, op, list);
5611 else if (input[i] ==
'*')
5617 if (i + 1 < input.size () && input[i + 1] ==
'=')
5621 if (var || array_ref)
5631 "KARL COMPILE WARNING (*=): " 5632 "Assignments must have a variable left hand side. Using .MADARA_I by " 5633 "default, but this is likely a major error in the expression.\n");
5644 precedence_insert (context, op, list);
5647 else if (input[i] ==
'%')
5656 precedence_insert (context, op, list);
5659 else if (input[i] ==
'/')
5662 if (i + 1 < input.size () && input[i + 1] ==
'/')
5665 for (; i < input.size () && input[i] !=
'\n'; ++i);
5668 else if (i + 1 < input.size () && input[i + 1] ==
'*')
5671 std::string::size_type found = input.find (
"*/", i + 1);
5675 if (found != std::string::npos)
5691 if (i + 1 < input.size () && input[i + 1] ==
'=')
5695 if (var || array_ref)
5704 "KARL COMPILE WARNING (/=): " 5705 "Assignments must have a variable left hand side. Using .MADARA_I by " 5706 "default, but this is likely a major error in the expression.\n");
5715 precedence_insert (context, op, list);
5719 else if (input[i] ==
'=')
5725 if (i + 1 < input.size () && input[i + 1] ==
'=')
5734 precedence_insert (context, op, list);
5737 else if (i + 1 < input.size () && input[i + 1] ==
'>')
5746 precedence_insert (context, op, list);
5758 precedence_insert (context, op, list);
5762 else if (input[i] ==
'!')
5768 if (i + 1 < input.size () && input[i + 1] ==
'=')
5782 precedence_insert (context, op, list);
5786 else if ((uint8_t)input[i] == 251)
5796 precedence_insert (context, op, list);
5799 else if (input[i] ==
'&')
5802 if (i + 1 < input.size () && input[i + 1] ==
'&')
5811 precedence_insert (context, op, list);
5817 "KARL COMPILE ERROR: " 5818 "Logical And (&) not available. " \
5819 "You may want to use && instead in %s.\n", input.c_str ());
5823 else if (input[i] ==
'|')
5826 if (i + 1 < input.size () && input[i + 1] ==
'|')
5835 precedence_insert (context, op, list);
5841 "KARL COMPILE ERROR: " 5842 "Logical And (|) not available. " \
5843 "You may want to use || instead in %s.\n", input.c_str ());
5847 else if (input[i] ==
';')
5853 if (i + 1 < input.size () && input[i + 1] ==
'>')
5866 precedence_insert (context, op, list);
5869 else if (input[i] ==
',')
5871 if (build_argument_list)
5880 precedence_insert (context, op, list);
5883 else if (input[i] ==
'<')
5889 if (i + 1 < input.size () && input[i + 1] ==
'=')
5901 precedence_insert (context, op, list);
5904 else if (input[i] ==
'>')
5910 if (i + 1 < input.size () && input[i + 1] ==
'=')
5922 precedence_insert (context, op, list);
5925 else if (input[i] ==
'(')
5929 handle_parenthesis (context, input, i, lastValidInput,
5930 handled, accumulated_precedence, list);
5932 else if (input[i] ==
'\t' || input[i] ==
' ' 5933 || input[i] ==
'\r' || input[i] ==
'\n')
5945 const std::string &input, std::string::size_type &i,
5947 bool & handled,
int & accumulated_precedence,
5948 ::std::list<madara::expression::Symbol *>& master_list)
5955 int initial_precedence = accumulated_precedence;
5957 ::std::list<Symbol *> list;
5960 bool closed =
false;
5961 while (i < input.length ())
5963 main_loop (context, input, i, lastValidInput,
5964 handled, accumulated_precedence, list,
true);
5966 if (input[i] ==
']')
5974 else if (input[i] ==
',')
5977 while (list.size ())
5979 master_list.push_back (list.back ());
5982 accumulated_precedence = initial_precedence;
5984 else if (i == input.length () - 1)
5993 "KARL COMPILE ERROR: " 5994 "Forgot to close parenthesis in %s.\n", input.c_str ());
5997 if (list.size () > 0)
5999 if (list.size () > 1)
6002 "KARL COMPILE ERROR: " 6003 "A parenthesis was closed, leaving multiple list items (there should " 6004 "be a max of 1) in %s.\n", input.c_str ());
6007 while (list.size ())
6009 master_list.push_back (list.back ());
6022 const std::string &input, std::string::size_type &i,
6024 bool & handled,
int & accumulated_precedence,
6025 ::std::list<madara::expression::Symbol *>& master_list,
6026 bool build_argument_list)
6033 int initial_precedence = accumulated_precedence;
6035 ::std::list<Symbol *> list;
6038 bool closed =
false;
6039 while (i < input.length ())
6041 main_loop (context, input, i, lastValidInput,
6042 handled, accumulated_precedence, list, build_argument_list);
6044 if (input[i] ==
')')
6052 else if (build_argument_list && input[i] ==
',')
6055 while (list.size ())
6057 master_list.push_back (list.back ());
6060 accumulated_precedence = initial_precedence;
6062 else if (i == input.length () - 1)
6068 if (!build_argument_list && !closed)
6071 "KARL COMPILE ERROR: " 6072 "Forgot to close parenthesis in %s.\n", input.c_str ());
6075 if (!build_argument_list && master_list.size () > 0 && list.size () > 0)
6077 Symbol * lastSymbol = master_list.back ();
6086 precedence_insert (context, list.back (), master_list);
6094 else if (list.size () > 0)
6096 if (list.size () > 1)
6099 "KARL COMPILE ERROR: " 6100 "A parenthesis was closed, leaving multiple list items (there should " 6101 "be a max of 1) in %s.\n", input.c_str ());
6104 while (list.size ())
6106 master_list.push_back (list.back ());
6122 ExpressionTreeMap::const_iterator found = cache_.find (input);
6123 if (found != cache_.end ())
6124 return found->second;
6126 ::std::list<Symbol *> list;
6128 Symbol * lastValidInput = 0;
6129 bool handled =
false;
6130 int accumulated_precedence = 0;
6131 std::string::size_type last_i = 0;
6133 for (std::string::size_type i = 0;
6134 i < input.length ();)
6139 main_loop (context, input, i, lastValidInput,
6140 handled, accumulated_precedence, list);
6144 if (input[i] ==
')')
6147 "KARL COMPILE ERROR: " 6148 "You have included too many closing parentheses in %s \n",
6154 "KARL COMPILE ERROR: " 6155 "Compilation is spinning at %d in %s. Char is %c\n",
6156 i, input.c_str (), input[i]);
6177 list.back ()->build (),
false);
6181 delete list.back ();
6184 cache_[input] = tree;
6193 #endif // _MADARA_NO_KARL_ 6195 #endif // _INTERPRETER_CPP_ Calculates a base term taken to a power.
This class encapsulates an entry in a KnowledgeBase.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~ReturnRight(void)
destructor
virtual ~Preincrement(void)
destructor
madara::knowledge::ThreadSafeContext & context_
Context for variables.
VariableDecrement(Symbol *lhs, madara::knowledge::KnowledgeRecord value, Symbol *rhs, madara::knowledge::ThreadSafeContext &context)
constructors
ExpressionTree interpret(madara::knowledge::ThreadSafeContext &context, const std::string &input)
Compiles an expression into an expression tree.
TernaryOperator(logger::Logger &logger, Symbol *left, Symbol *right, int precedence_=1)
constructor
virtual ~Assignment(void)
destructor
virtual ~VariableDivide(void)
destructor
Sets the system clock or a variable clock.
virtual ~Symbol(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
ToString(madara::knowledge::ThreadSafeContext &context_)
constructor
Fragment(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ~Not(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Postincrement node of the parse tree.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~ExpandEnv(void)
destructor
Returns the square root of a term.
virtual ~LessThan(void)
destructor
virtual ~Or(void)
destructor
std::vector< Symbol * > Symbols
Returns the time in nanoseconds since epoch.
Evaluates both left and right children, regardless of values.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
ToHostDirs(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
WriteFile(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Equality(logger::Logger &logger)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Composite node that divides a variable by some right hand side.
Sleeps for a certain amount of time.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Returns the cosine of a term (radians)
Function node of the parse tree.
Defines a terminal node of that references the current value stored in a variable.
A composite node that increments a right expression.
virtual ~ClearVariable(void)
destructor
Returns the cosine of a term in radians.
Sets the output format to use std::scientific.
virtual ~UnaryOperator(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~Modulus(void)
destructorm
Converts an argument to an array of doubles.
Type(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ~Size(void)
destructor
Defines a terminal node of that references the current value stored in a variable.
VariableMultiply(Symbol *lhs, madara::knowledge::KnowledgeRecord value, Symbol *rhs, madara::knowledge::ThreadSafeContext &context)
constructors
Check and left and right arguments for equality.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Division node of the parse tree.
madara::knowledge::ThreadSafeContext & context_
Context for variables.
virtual ~WriteFile(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
A composite node that encompasses addition of two expressions.
Expands a statement, e.g.
Encapsulates a MADARA KaRL expression into an evaluatable tree.
virtual ~ToIntegers(void)
destructor
Abstract base class for operators with 3+ potential subnodes.
A composite node that compares left and right children for inequality.
GetClock(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Check and left and right arguments for less than or equal to.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Returns a random integer.
SquareRootUnary(logger::Logger &logger)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Check and left and right arguments for less than.
virtual ~ToInteger(void)
destructor
Addition node of the parse tree.
Print(madara::knowledge::ThreadSafeContext &context_)
constructor
Returns a version that has a directory structure appropriate to the OS.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
List(madara::knowledge::ThreadSafeContext &context)
constructors
ForLoop(Symbol *precondition, Symbol *condition, Symbol *postcondition, Symbol *body, madara::knowledge::ThreadSafeContext &context)
constructor
And(logger::Logger &logger)
constructor
virtual ~Equality(void)
destructor
std::deque< ComponentNode * > ComponentNodes
a vector of Component Nodes
Composite node that subtracts a variable by some right hand side.
Interpreter()
Constructor.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
A composite node that encompasses subtraction of a right expression from a left expression.
Cos(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Assign the value of an expression to a variable.
A composite node that iterates until a condition is met.
A composite node that divides a left expression by a right expression and returns the remainder of th...
virtual ~SquareRootUnary(void)
destructor
A composite node that compares left and right expressions for greater than or equal to...
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Generates a random double.
A composite node that evaluates both left and right expressions regardless of their evaluations...
A composite node that compares left and right children for less than or equal to. ...
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~Sleep(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Converts an argument to a string.
Postincrement(logger::Logger &logger)
constructor
Returns the expansion of a statement.
virtual ~GetTime(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
A composite node that multiplies a left expression by a right expression.
RandDouble(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ~VariableMultiply(void)
destructor
A composite node that evaluates both left and right expressions regardless of their evaluations...
A composite node that takes the square root of a term.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~Both(void)
destructor
virtual ~Fragment(void)
destructor
virtual ~ExpandStatement(void)
destructor
virtual ~SystemCall(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Modulus node of the parse tree (10 % 4 == 2)
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
A composite node that decrements a left expression.
virtual ~ToDoubles(void)
destructor
Check and left and right arguments for inequality.
Returns the sin of a term in radians.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
A composite node that performs an implication (inference rule)
A composite node that decrements a right expression.
Reads or sets the MADARA log level.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Sets the output format to std::fixed.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
This class stores variables and their values for use by any entity needing state information in a thr...
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Attempts to clear a variable.
ArrayRef(const std::string &key, Symbol *index, madara::knowledge::ThreadSafeContext &context)
constructors
madara::knowledge::KnowledgeRecord value_
value can be faster than rhs_, so use it if possible
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
void precedence_insert(madara::knowledge::ThreadSafeContext &context, Symbol *op,::std::list< Symbol * > &list)
Inserts a mathematical operator into the tree.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Returns the clock of the argument or the system clock.
Attempts to delete a variable.
GetTime(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Returns a fragment of the knowledge record.
madara::knowledge::KnowledgeRecord prune(void)
Prunes the expression tree of unnecessary nodes.
Prints a Knowledge Record to the stderr.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
void main_loop(madara::knowledge::ThreadSafeContext &context, const std::string &input, std::string::size_type &i, Symbol *&lastValidInput, bool &handled, int &accumulated_precedence,::std::list< Symbol * > &list, bool build_argument_list=false)
Inserts a variable into the tree.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
A composite node that evaluates both left and right expressions regardless of their evaluations...
Number(logger::Logger &logger, std::string input)
constructors
Postdecrement(logger::Logger &logger)
constructor
VariableCompare(Symbol *lhs, madara::knowledge::KnowledgeRecord value, Symbol *rhs, int compare_type, madara::knowledge::ThreadSafeContext &context)
constructors
virtual ~GreaterThan(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~SetClock(void)
destructor
A composite node that calls a function.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Defines a node that contains a madara::knowledge::KnowledgeRecord::Integer value. ...
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Provides knowledge logging services to files and terminals.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~Power(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~DeleteVariable(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
madara::knowledge::ThreadSafeContext & context_
#define madara_logger_log(logger, level,...)
Fast version of the madara::logger::log method.
Writes a knowledge record to an user-specified file name.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Converts an argument into an unsigned char buffer.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~VariableDecrement(void)
destructor
Returns the type of a specified knowledge record.
Returns a base term taken to a power (exponent)
Operator(logger::Logger &logger, Symbol *left, Symbol *right, int precedence_=1)
constructor
virtual ~Eval(void)
destructor
VariableIncrement(Symbol *lhs, madara::knowledge::KnowledgeRecord value, Symbol *rhs, madara::knowledge::ThreadSafeContext &context)
constructors
GreaterThanEqual(logger::Logger &logger)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Predecrement(logger::Logger &logger)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Multiply(logger::Logger &logger)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Postdecrement node of the parse tree.
Divide a variable by a certain amount.
SetScientific(madara::knowledge::ThreadSafeContext &context_)
constructor
Abstract base class for all parse tree node operators.
madara::knowledge::KnowledgeRecord value_
value can be faster than rhs_, so use it if possible
Sets or returns the current MADARA logging level.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~SetFixed(void)
destructor
Sequence(logger::Logger &logger)
constructor
Returns the size of a specified knowledge record.
virtual ~SetPrecision(void)
destructor
Returns the tangent of a term (radians)
SquareRoot(madara::knowledge::ThreadSafeContext &context_)
constructor
LessThan(logger::Logger &logger)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
A multi-threaded logger for logging to one or more destinations.
virtual ~SquareRoot(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
void set_value(const KnowledgeRecord &new_value)
Sets the value from another KnowledgeRecord, does not copy clock and write_quality.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Power(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
A composite node that performs a logical and.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Returns the size of a record.
virtual ~ToBuffer(void)
destructor
Returns the expansion of a statement with environment vars.
virtual ~ToHostDirs(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~Sequence(void)
destructor
virtual ~ForLoop(void)
destructor
Evaluates both left and right children, regardless of values.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
GreaterThan(logger::Logger &logger)
constructor
SetPrecision(madara::knowledge::ThreadSafeContext &context_)
constructor
Predecrement node of the parse tree.
Converts an argument to an array of integers.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Or(logger::Logger &logger)
constructor
void number_insert(madara::knowledge::ThreadSafeContext &context, const std::string &input, std::string::size_type &i, int &accumulated_precedence,::std::list< Symbol * > &list, Symbol *&lastValidInput)
Inserts a number into the tree.
void string_insert(char opener, madara::knowledge::ThreadSafeContext &context, const std::string &input, std::string::size_type &i, int &accumulated_precedence,::std::list< Symbol * > &list, Symbol *&lastValidInput)
Inserts a variable into the tree.
Fragment the Knowledge Record.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Sets the system or a variable clock.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~RandDouble(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~Number(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Returns the square root of a term.
Composite node that multiplies a variable by some right hand side.
Sleep(madara::knowledge::ThreadSafeContext &context_)
constructor
Symbol(logger::Logger &logger, Symbol *left, Symbol *right, int precedence_=0)
constructor
virtual ComponentNode * build(void)=0
abstract method for building an Expression ExpressionTree Node
virtual ~TernaryOperator(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Check and left and right arguments for greater than.
int compare_type_
type of comparison. See madara/Globals.h
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
ReturnRight(logger::Logger &logger)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
A composite node that compares left and right expressions for equality.
Returns the current time in seconds since epoch.
Subtract(logger::Logger &logger)
constructor
virtual ~GetTimeSeconds(void)
destructor
Prints all supported system calls.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Symbol * rhs_
rhs is used for complex rhs types (not a simple number)
Divide(logger::Logger &logger)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Preincrement(logger::Logger &logger)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
madara::knowledge::ThreadSafeContext & context_
A composite node that increments a right expression.
Converts an argument to a double.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
const std::string key_
Key for retrieving value of this variable.
Evaluates a knowledge::KnowledgeRecord and returns the evaluation result.
Sleeps for a certain amount of time.
ClearVariable(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
SystemCall(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~ArrayRef(void)
destructor
Abstract base class of all parse tree nodes.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~PrintSystemCalls(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Both(logger::Logger &logger)
constructor
Sets the double precision for converting doubles to a string and for printing.
ToDoubles(madara::knowledge::ThreadSafeContext &context_)
constructor
Negate node of the parse tree.
virtual ~ToDouble(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Modulus(logger::Logger &logger)
constructor
virtual ~GetClock(void)
destructor
A composite node that logically nots a right expression.
A composite node that allows for variable assignment.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
A composite node that compares left and right children for greater than.
Returns the system clock or a variable clock.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Returns the type of a record.
ToBuffer(madara::knowledge::ThreadSafeContext &context_)
constructor
logger::Logger * logger_
left and right pointers
Tan(madara::knowledge::ThreadSafeContext &context_)
constructor
Returns the wall clock time in seconds.
Add(logger::Logger &logger)
constructor
Assign the value of an expression to a variable.
madara::knowledge::ThreadSafeContext & context_
virtual ~ReadFile(void)
destructor
virtual ~Function(void)
destructor
An abstract base class defines a simple abstract implementation of an expression tree node...
virtual ~Variable(void)
destructor
void handle_parenthesis(madara::knowledge::ThreadSafeContext &context, const std::string &input, std::string::size_type &i, Symbol *&lastValidInput, bool &handled, int &accumulated_precedence,::std::list< Symbol * > &list, bool build_argument_list=false)
Handles a parenthesis.
Preincrement node of the parse tree.
ConstArray(madara::knowledge::ThreadSafeContext &context)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Returns the tangent of a term in radians.
Logically and node of the parse tree.
LessThanEqual(logger::Logger &logger)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
A composite node that integrally negates a right expression.
virtual ~Negate(void)
destructor
LogLevel(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Negate(logger::Logger &logger)
constructor
void system_call_insert(madara::knowledge::ThreadSafeContext &context, const std::string &input, std::string::size_type &i, int &accumulated_precedence,::std::list< Symbol * > &list, Symbol *&lastValidInput)
Inserts a system call into the tree.
virtual ~Postdecrement(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Returns the wall clock time.
A composite node that contains an array of values.
VariableDivide(Symbol *lhs, madara::knowledge::KnowledgeRecord value, Symbol *rhs, madara::knowledge::ThreadSafeContext &context)
constructors
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Implies(logger::Logger &logger)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~Implies(void)
destructor
madara::knowledge::ThreadSafeContext & context_
Context for variables.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
madara::knowledge::ThreadSafeContext & context_
Context for variables.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
UnaryOperator(logger::Logger &logger, Symbol *right, int precedence_=1)
constructor
Eval(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Clears a variable in the knowledge base.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
madara::knowledge::ThreadSafeContext & context_
Context for variables.
Sets the precision of doubles.
Deletes a variable from the knowledge base.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Function(const std::string &name, madara::knowledge::ThreadSafeContext &context)
constructor
virtual ~RandInt(void)
destructor
virtual ~Subtract(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~GreaterThanEqual(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
RandInt(madara::knowledge::ThreadSafeContext &context_)
constructor
Sets the output format to use std::fixed.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~Postincrement(void)
destructor
Logically or node of the parse tree.
Abstract base class for operators with 3+ potential subnodes.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
SetClock(madara::knowledge::ThreadSafeContext &context_)
constructor
madara::knowledge::KnowledgeRecord value_
value can be faster than rhs_, so use it if possible
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
void handle_for_loop(madara::knowledge::ThreadSafeContext &context, std::string &variable, const std::string &input, std::string::size_type &i, int &accumulated_precedence,::std::list< Symbol * > &list, Symbol *&returnableInput)
extracts precondition, condition, postcondition, and body from input
ExpandEnv(madara::knowledge::ThreadSafeContext &context_)
constructor
Sin(madara::knowledge::ThreadSafeContext &context_)
constructor
Variable(const std::string &key, madara::knowledge::ThreadSafeContext &context)
constructors
Returns the sin of a term (radians)
void handle_array(madara::knowledge::ThreadSafeContext &context, const std::string &input, std::string::size_type &i, Symbol *&lastValidInput, bool &handled, int &accumulated_precedence,::std::list< Symbol * > &list)
Handles a parenthesis.
virtual ~Sin(void)
destructor
virtual ~ConstArray(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
A composite node that performs a logical or.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~Cos(void)
destructor
DeleteVariable(madara::knowledge::ThreadSafeContext &context_)
constructor
Subtraction node of the parse tree.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~Divide(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Increment a variable by a certain amount.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Assignment(logger::Logger &logger)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Ensures the directory delimiters are appropriate for the host operating system (e.g., on Windows, '\' and Linux, '/')
virtual ~Predecrement(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
Multiply a variable by a certain amount.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
madara::knowledge::KnowledgeRecord item_
contains the value of the leaf node
Reads a file from an user-provided file name.
Decrement a variable by a certain amount.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~Add(void)
destructor
Size(madara::knowledge::ThreadSafeContext &context_)
constructor
A composite node that divides a left expression by a right one.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
ToIntegers(madara::knowledge::ThreadSafeContext &context_)
constructor
Evaluates a Knowledge Record and returns result.
virtual ~And(void)
destructor
Copyright (c) 2015 Carnegie Mellon University.
logger::Logger & get_logger(void) const
Gets the logger used for information printing.
virtual ~Tan(void)
destructor
Leaf node for an array reference.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Sets the output to std::scientific.
Logically not the right node.
SetFixed(madara::knowledge::ThreadSafeContext &context_)
constructor
Expands a statement, e.g.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Inequality(logger::Logger &logger)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
madara::knowledge::KnowledgeRecord value_
value can be faster than rhs_, so use it if possible
Defines a terminal node of that references the current value stored in a variable.
madara::knowledge::ThreadSafeContext & context_
Context for variables.
ToInteger(madara::knowledge::ThreadSafeContext &context_)
constructor
const std::string key_
Key for retrieving value of this variable.
virtual ~Print(void)
destructor
Increment a variable by a certain amount.
virtual ~Inequality(void)
destructor
GetTimeSeconds(madara::knowledge::ThreadSafeContext &context_)
constructor
Generates a random integer.
ReadFile(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
madara::knowledge::ThreadSafeContext & context_
Context for variables.
virtual ~LogLevel(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual ~VariableIncrement(void)
destructor
PrintSystemCalls(madara::knowledge::ThreadSafeContext &context_)
constructor
Evaluates both left and right children and returns right value.
virtual ~List(void)
destructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~Multiply(void)
destructor
Not(logger::Logger &logger)
constructor
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Check and left and right arguments for greater than or equal to.
virtual ~Interpreter()
Destructor.
Prints a Knowledge Record.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~SetScientific(void)
destructor
virtual ~ToString(void)
destructor
ExpandStatement(madara::knowledge::ThreadSafeContext &context_)
constructor
Converts an argument to an integer.
Defines a terminal node that contains a list.
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
virtual int precedence(void)
abstract method for returning precedence level (higher value means higher precedence ...
ToDouble(madara::knowledge::ThreadSafeContext &context_)
constructor
virtual ~VariableCompare(void)
destructor
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Prints a help menu for all system calls.
virtual int add_precedence(int accumulated_precedence)=0
Defines a terminal node of that references the current value stored in a variable.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual int add_precedence(int accumulated_precedence)
returns the precedence level
Multiplication node of the parse tree.
virtual ~Type(void)
destructor
virtual ~LessThanEqual(void)
destructor
A composite node that compares left and right children for less than.
Abstract base class for all parse tree node operators.
madara::knowledge::ThreadSafeContext & context_
Context for variables.
madara::knowledge::ThreadSafeContext & context_
Context for variables.
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
virtual ~Operator(void)
destructor
A constant array that should not be changed.
Iterative looping node of the parse tree.
madara::knowledge::KnowledgeRecord value_
value can be faster than rhs_, so use it if possible
virtual ComponentNode * build(void)
builds an equivalent ExpressionTree node
void variable_insert(madara::knowledge::ThreadSafeContext &context, const std::string &input, std::string::size_type &i, int &accumulated_precedence,::std::list< Symbol * > &list, Symbol *&lastValidInput)
Inserts a variable into the tree.