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

📄 set.java

📁 A compiler for a subset of the Java language
💻 JAVA
字号:
package inter;import symbols.*;public class Set extends Stmt {   public Id id; public Expr expr;   public Set(Id i, Expr x) {      id = i; expr = x;      if ( check(id.type, expr.type) == null ) error("type error");   }   public Type check(Type p1, Type p2) {      if ( Type.numeric(p1) && Type.numeric(p2) ) return p2;      else if ( p1 == Type.Bool && p2 == Type.Bool ) return p2;      else return null;   }   public void gen(int b, int a) {      //emit( id.toString() + " = " + expr.gen().toString() );	  emit(expr.gen().toString());	  if(expr.type == Type.Int)	  {		  emit("istore " + id.lvaIdx + "\n");	  }	  else if(expr.type == Type.Float)	  {		  emit("fstore " + id.lvaIdx + "\n");	  }	  else if(expr.type == Type.Complex)	  {		  emit("fstore " + (id.lvaIdx + 4) + "\n");    	  emit("fstore " + id.lvaIdx + "\n");	  }   }}

⌨️ 快捷键说明

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