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

📄 type.java

📁 Java编写的编译器前端
💻 JAVA
字号:
package lexer;		// File Type.javapublic class Type extends Word {	public int width = 0;	public Type(String s, int tag, int w) { super(s, tag); width = w; }	public static final Type		Int    = new Type( "int",    Tag.BASIC, 4 ),		Double = new Type( "double", Tag.BASIC, 8 ),	        Char   = new Type( "char",   Tag.BASIC, 1 ),		Bool   = new Type( "bool",   Tag.BASIC, 1 );	public static boolean numeric(Type p){		if (p == Type.Char || p == Type.Int || p == Type.Double) return true;		else return false;	}	public static Type max(Type p1, Type p2) {		if ( !numeric(p1) || !numeric(p2) ) return null;		else if (p1 == Type.Double || p2 == Type.Double ) return Type.Double;		else if (p1 == Type.Int || p2 == Type.Int ) return Type.Int;		else return Type.Char;	}}

⌨️ 快捷键说明

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