classprogram.java
来自「用Java实现的编译器。把源代码编译成SPARC汇编程序」· Java 代码 · 共 48 行
JAVA
48 行
package CatDecaf.SymTable;
import java.util.*;
public class ClassProgram{
public SymbolTable fieldVar;
public SymbolTable methods;
public static String indent;
public static int scope;
public static int numOfError;
public static int numOfWarning;
public static boolean semanticCheck;
//public static LinkedHashMap constantTable;
public ClassProgram(){
fieldVar = new SymbolTable();
methods = new SymbolTable();
methods.setParent(fieldVar);
methods.assertMethodST();
//constantTable = new LinkedHashMap();
//check = true;
indent = new String("");
}
public int getMaxParamSize(){
int max = 0;
Iterator i = methods.getDescriptorTable().values().iterator();
while(i.hasNext()){
int x = ((MethodDescriptor)i.next()).getParamSize();
if(max < x) max = x;
}
return max;
}
public int getMaxLocalSize(){
int max = 0;
Iterator i = methods.getDescriptorTable().values().iterator();
while(i.hasNext()){
int x = ((MethodDescriptor)i.next()).getLocalSize();
if(max < x) max = x;
}
return max;
}
public void pPrint(){
fieldVar.pPrint();
methods.pPrint();
System.out.println("Max Param = " + this.getMaxParamSize() + ", Max Local = " + this.getMaxLocalSize());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?