public Type Visit(AssignStatement assignStatement, FunctionGeneratorEnvironment arg) { var type = arg.GetIdentifierType(assignStatement.id); var offset = arg.GetIdentifierOffset(assignStatement.id); Program.Emit(T42Instruction.LVAL(offset)); assignStatement.s.Accept(this, arg); if (type.GetType() == typeof(IntType)) { Program.Emit(T42Instruction.ASSINT); Program.Emit(T42Instruction.RVALINT(offset)); } else { Program.Emit(T42Instruction.ASSBOOL); Program.Emit(T42Instruction.RVALBOOL(offset)); } return(type); }
public Type Visit(IdentifierStatement identifierStatement, FunctionGeneratorEnvironment arg) { if (identifierStatement.list == null) { var type = arg.GetIdentifierType(identifierStatement.id); var offset = arg.GetIdentifierOffset(identifierStatement.id); if (type.GetType() == typeof(IntType)) { Program.Emit(T42Instruction.RVALINT(offset)); return(new IntType()); } else { Program.Emit(T42Instruction.RVALBOOL(offset)); return(new BoolType()); } } else { // CALL STATEMENT return(new BoolType()); } }