public void visitPlus(PlusOperationNode node) { readValues(node); if (intType) { int value = popInt() + popInt(); this.intStack.Push(value); } else if (strType) { string value = popString() + popString(); this.strStack.Push(value); } }
public void visitPlus(PlusOperationNode node) { accessChildren(node); MiniPLTokenType left = this.typeStack.Pop(); MiniPLTokenType right = this.typeStack.Pop(); if (left == MiniPLTokenType.TYPE_IDENTIFIER_STRING) { if (left != right) { throw new SemanticException("Wrong type. Expected a string."); } this.typeStack.Push(MiniPLTokenType.TYPE_IDENTIFIER_STRING); } else if (left == MiniPLTokenType.TYPE_IDENTIFIER_INTEGER) { if (left != right) { throw new SemanticException("Wrong type. Expected a string."); } this.typeStack.Push(MiniPLTokenType.TYPE_IDENTIFIER_INTEGER); } }
public void visitPlus(PlusOperationNode node) { }