Expr *Condition() { Expr *left = Expression(); Operator op = RelOp(); Expr *right = Expression(); return new Bop(op, left, right); }
void Condition() { Expression(); Operator op = RelOp(); Expression(); Gener(BOP, op); }
bool Add(_tK const &Key, _tV const &Value) { _tRelOp RelOp; tNode *pNew = nullptr; tNode *pParent = nullptr; if (!pRoot) pNew = new tNode(Key, Value); else { tNode *pNode = dynamic_cast<tNode *>(FindNode(dynamic_cast<tNode *>(pRoot), Key, &pParent)); if (pNode) return false; // Key is already present in Tree. pNew = new tNode(Key, Value); } if (!pParent) pRoot = pNew; else { pNew->pUp = pParent; if (RelOp(Key, pParent->KV.first)) pParent->pLeft = pNew; else pParent->pRight = pNew; } InvalidateCache(); ++NodeCount; return true; } // Add()
void Parser::Expr(int &type) { int type1, op; SimExpr(type); if (la->kind == 14 || la->kind == 15 || la->kind == 16) { RelOp(op); SimExpr(type1); if (type != type1) Err(L"incompatible types"); gen->Emit(op); type = boolean; } }
bool Parser::Condition() { if (!Expr()) return false; if (!RelOp()) return false; if (!Expr()) return false; std::cout << "Condition => Expr RelOp Expr\n"; return true; }
bool Parser::Condition() { if (!Expr()) return false; if (!RelOp()) return false; if (!Expr()) return false; if (curr_relop == "<") { assembly.push_back(icode(a_line, "LESS")); ++a_line; } else if (curr_relop == ">") { assembly.push_back(icode(a_line, "GRTR")); ++a_line; } else if (curr_relop == "=") { assembly.push_back(icode(a_line, "EQL")); ++a_line; } else if (curr_relop == "<=") { assembly.push_back(icode(a_line, "GRTR")); ++a_line; assembly.push_back(icode(a_line, "NOT")); ++a_line; } else if (curr_relop == ">=") { assembly.push_back(icode(a_line, "LESS")); ++a_line; assembly.push_back(icode(a_line, "NOT")); ++a_line; } else if (curr_relop == "<>") { assembly.push_back(icode(a_line, "EQL")); ++a_line; assembly.push_back(icode(a_line, "NOT")); ++a_line; } else { std::cout << "Invalid relation encountered: " << curr_relop << std::endl; return false; } // std::cout << "Condition => Expr RelOp Expr\n"; return true; }