blob: 52977c7a45b4b6a67aaa89a34e53171a36b037c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package codegen;
public class Label {
private static String funDef = "";
private static int labelCounter = 0;
private static int functionLabelCounter = 0;
public static void addFunDef(String s) {
funDef += s;
}
public static String getFunDef() {
return funDef;
}
/**
* 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++);
}
}
|