public static void AssignmentOperator() { SAR y = SAS.Pop(); SAR x = SAS.Pop(); if (x.dataType[0] == '@' && (x.argList != null && x.argList.Count > 0)) { x.dataType = x.dataType.Substring(1); } if (y.dataType[0] == '@' && (y.argList != null && y.argList.Count > 0)) { y.dataType = y.dataType.Substring(1); } if ((x.sarType == SAR.SARtype.Identifier || x.sarType == SAR.SARtype.Ref) && (x.dataType == y.dataType || y.value == "null" || y.dataType == "null")) { if ((y.value == "null" || y.dataType == null) && (x.dataType == "int" || x.dataType == "char" || x.dataType == "bool")) { } else { ICode.MOV(x.symid, y.symid); OS.Pop(); OSprecidence.Pop(); return; } } SemanticOperationError(x, y, OS.Peek()); }
public static void itoa() { SAR exp = SAS.Pop(); if (exp.dataType != "int") { SemanticAtoiError(exp); } string[] data = { "returnType:char", "accessMod:private" }; Symbol temp = new Symbol("t", "t" + uniqueCounter++, "t" + exp.value, "tvar", data); SymbolTable.Add(temp); ICode.MOV(temp.symid, exp.symid); ICode.CONVERT(temp.symid); exp.dataType = "char"; exp.symid = temp.symid; SAS.Push(exp); }