Ejemplo n.º 1
0
 private void AddVarToVarTable(string varName, ZOperand zOperand) {
     if (varTable.Peek().ContainsKey(varName)) throw new Exception("variable " + varName + " can't have duplicate definition");
     varTable.Peek()[varName] = zOperand;
 }
Ejemplo n.º 2
0
        private ZOperand Compute(ZOperand left, string oper, ZOperand right = null) {
              //very important
            Operand resultValue = null;
            resultValue = right == null ? Compute(left.Operand, oper, null) : Compute(left.Operand, oper, right.Operand);

            if (resultValue == null) throw new Exception("invaild expression");
            else {
                return new ZOperand(resultValue, getTypeString(resultValue.GetReturnType(tm)));
            }
        }