本文整理汇总了C++中ExprNode::toInstruction方法的典型用法代码示例。如果您正苦于以下问题:C++ ExprNode::toInstruction方法的具体用法?C++ ExprNode::toInstruction怎么用?C++ ExprNode::toInstruction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExprNode
的用法示例。
在下文中一共展示了ExprNode::toInstruction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compile
// Evaluate
// Tokenizes the string, converts to post-fix order, and evaluates that
// Parameters:
// str (input char array) - string to evaluate
// Pre-condition: str must be a valid integer arithmetic expression including matching parentheses.
void compile(const char str[], VarTree &vars, FunctionDef& funs, Instruction *prog[],
int& pBegin, int& pEnd)
{
TokenList list(str);
ListIterator iter = list.begin();
int tempCounter = 0;
if (tokenText(iter,list) == "deffn")
{
//cout << list << endl;
makeFunction(iter, list, funs);
//return 0;
}
else
{
ExprNode* root = assignmentToTree(iter,list,funs);
#ifdef DEBUG
cout << *root << endl;
#endif
//return root->evaluate(vars, funs);
int tempCounter = 0;
int answerReg = root->toInstruction(prog, pEnd, tempCounter, vars);
pBegin = 0;
prog[pEnd++] = new Print(answerReg);
}
//cout << root->makedc() << endl
//cout << *root << endl;
}