1 #ifndef _DEBUGEXPRESSIONEVALUATOR_H_ 2 #define _DEBUGEXPRESSIONEVALUATOR_H_ 3 4 #include <vector> 5 #include "Types.h" 6 #include "MIPS.h" 7 8 class CDebugExpressionEvaluator 9 { 10 public: 11 static uint32 Evaluate(const char*, CMIPS*); 12 13 private: 14 enum TOKEN_TYPE 15 { 16 TOKEN_TYPE_INVALID, 17 TOKEN_TYPE_NUMBER, 18 TOKEN_TYPE_OP, 19 TOKEN_TYPE_SYMBOL, 20 }; 21 22 struct TOKEN 23 { 24 TOKEN_TYPE type; 25 std::string value; 26 }; 27 28 enum OP_TYPE 29 { 30 OP_INVALID, 31 OP_FIRST, 32 OP_ADD, 33 OP_SUB, 34 OP_MUL, 35 OP_DIV, 36 }; 37 38 typedef std::vector<TOKEN> TokenArray; 39 40 static TokenArray Parse(const char*); 41 static uint32 Evaluate(const TokenArray&, CMIPS*); 42 }; 43 44 #endif 45