#include "ExpressionTree.h" using namespace std; /* * Constructor to build an Expression Tree based upon an array of * 'tokens' */ ExpressionTree::ExpressionTree(int numTokens, const Token tokens[]) { } /* * Evaluate the underlying expression, returning the result of that evaluation. */ int ExpressionTree::evaluate() const { return -1; // REPLACE THIS } /* * Overloaded output operator should result in echoing the underlying * arithemtic expression in fully-parenthesized form. */ ostream& operator<<(ostream& out, const ExpressionTree& T) { return out; } /*================================================ * EXTRA CREDIT follows *================================================*/ /* * EXTRA CREDIT version of constructor to build an Expression Tree * based upon an array of 'tokens' * * This version handles more general syntax which is not fully * parenthesized, and throws and InvalidExpressionException in the * case where the input has invalid syntax. */ ExpressionTree::ExpressionTree(const Token tokens[], int numTokens) { }