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

📄 locationarray.java

📁 用Java实现的编译器。把源代码编译成SPARC汇编程序
💻 JAVA
字号:
package CatDecaf.IR; // Java Package generated by the BNF Converter.
import parser.*;
import CatDecaf.Utilities.Debugger.*;
import java6035.tools.ASM.*;
public class LocationArray extends Location implements CatDecaf.Utilities.Visitable
{
  public Identifier identifier_;
  public Exp exp_;
  public int type;
  public SPARCRegister reg;

  public LocationArray(Identifier p1, Exp p2) 
  	{ identifier_ = p1; exp_=p2;
	   type = identifier_.getType();
	   if(exp_.noError() && exp_.getType()!=sym.INT) 
	   	ErrorLog.log("Integer type expected for Array index");
	   reg = null;
  	}
	public int getType(){return type;}	
	public boolean noError(){return !(type==sym.ERROR_TYPE);}
	public SPARCRegister getReg(){
		return reg;
	}

	public void setReg(SPARCRegister r){
		reg=r;
		reg.status = 1;
	}
	public void releaseReg(){
		reg.status = 0;
		reg= null;
	}	
// a[exp] = 2;
// smul r0, 4, r1
// add fp%, r0, r2
// ld r2, 2
  public void accept(CatDecaf.Utilities.Visitor v) { v.visit(this); }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -