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

📄 constant.java

📁 A compiler for a subset of the Java language
💻 JAVA
字号:
package inter;import lexer.*; import symbols.*;public class Constant extends Expr {   public Constant(Token tok, Type p) { super(tok, p); }   public Constant(int i) { super(new Num(i), Type.Int); }   public static final Constant      True  = new Constant(Word.True,  Type.Bool),      False = new Constant(Word.False, Type.Bool);   public void jumping(int t, int f) {      if ( this == True && t != 0 ) emit("goto L" + t);      else if ( this == False && f != 0) emit("goto L" + f);   }      public String toString()   {	   if(type == Type.Int)	   {		   return "ldc " + ((Num)op).value + "\n";	   }	   else if(type == Type.Float)	   {		   return "ldc " + ((Real) op).value + "\n";   	   }	   else if(type == Type.Complex)	   {		   return "ldc 0.0\nldc " + ((Complex) op).iValue + "\n";	   }	   return "nop\n";   }}

⌨️ 快捷键说明

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