32 std::string expression_string =
"not(A and B) or C";
36 symbol_table.create_variable(
"B");
37 symbol_table.create_variable(
"C");
43 parser.compile(expression_string,expression);
45 printf(
" # | A | B | C | %s\n" 46 "---+---+---+---+-%s\n",
47 expression_string.c_str(),
50 for (
int i = 0; i < 8; ++i)
52 symbol_table.get_variable(
"A")->ref() = T((i & 0x01) ? 1 : 0);
53 symbol_table.get_variable(
"B")->ref() = T((i & 0x02) ? 1 : 0);
54 symbol_table.get_variable(
"C")->ref() = T((i & 0x04) ? 1 : 0);
56 int result =
static_cast<int>(expression.value());
58 printf(
" %d | %d | %d | %d | %d \n",
60 static_cast<int>(symbol_table.get_variable(
"A")->value()),
61 static_cast<int>(symbol_table.get_variable(
"B")->value()),
62 static_cast<int>(symbol_table.get_variable(
"C")->value()),