package codegen; public class Label { private static String funDef = ""; private static int labelCounter = 0; private static int globalVarNum = 0; private static int functionLabelCounter = 0; private static int varDefCount = 0; public static void addFunDef(String s) { funDef += s; } public static String getFunDef() { return funDef; } public static void addGlobalVar() { globalVarNum++; } public static int getGlobalVarNum() { return globalVarNum; } /** * Create a new basic label. Use this method to define labels for if, while and * for statemests. */ public static String newBasic(String base) { return base + (labelCounter++); } /** * Create a new label for a function definition. */ public static String newFun(String base) { return base + (functionLabelCounter++); } public static String newVar() { return "_tmp" + (varDefCount++); } }