⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classprogram.java

📁 用Java实现的编译器。把源代码编译成SPARC汇编程序
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -