return result;
}
BigInteger evalConditionalExpression(AstNode exprAst) {
if (exprAst.getNumberOfChildren() == 5) {
AstNode decisionOperand = exprAst.getChild(0);
AstNode trueCaseOperand = exprAst.getChild(2);
AstNode falseCaseOperand = exprAst.getChild(4);
return eval(decisionOperand) ? evalToInt(trueCaseOperand) : evalToInt(falseCaseOperand);
}
else {
AstNode decisionOperand = exprAst.getChild(0);
AstNode falseCaseOperand = exprAst.getChild(3);
BigInteger decision = evalToInt(decisionOperand);
return decision.compareTo(BigInteger.ZERO) != 0 ? decision : evalToInt(falseCaseOperand);
}
}