expshiftleft.java
来自「用Java实现的编译器。把源代码编译成SPARC汇编程序」· Java 代码 · 共 43 行
JAVA
43 行
/**
*This class is used for expressions using the left shift operation.
*This class extends the Exp abstract class
**/
package CatDecaf.IR;
import CatDecaf.Utilities.*;
import parser.*;
import CatDecaf.Utilities.Debugger.*;
import java6035.tools.ASM.*;
public class ExpShiftLeft extends Exp{
public Exp exp1_, exp2_;
public int type;
public SPARCRegister reg;
public ExpShiftLeft(Exp e1, Exp e2){
type = sym.INT;
if (e1.noError() && e1.getType()!=sym.INT)
ErrorLog.log("Integer type expected on LHS of '<<'");
if (e2.noError() && e2.getType()!=sym.INT)
ErrorLog.log("Integer type expected on RHS of '<<'");
exp1_ = e1;
exp2_ = e2;
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;
}
public void accept(Visitor v){
v.visit(this);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?