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

📄 varexpr.java

📁 用Java实现的编译器。把源代码编译成SPARC汇编程序
💻 JAVA
字号:
// $Id: VarExpr.java,v 1.4 2000/10/21 22:44:34 mdeeds Exp $package java6035.tools.IR;/** * VarExpr represents a variable expression. */public class VarExpr extends Expression{    protected VarDescriptor var;    /**     * Creates a new VarExpression for the @param var.     * This should be the symboltable entry for @param var.     **/    public VarExpr(VarDescriptor var)    {        this.var = var;    }    /**     * Returns the kind of this expression. (i.e. VAR_EXPR)     **/    protected int expkind()    {	return VAR_EXPR;    }    /**     * Returns the variable descriptor.  (Not a clone.)     **/    public VarDescriptor getOperand()    {	return var;    }    /**     * Sets the variable descriptor.     **/    public void setOperand(VarDescriptor v)    {	this.var = v;    }    /**     * Walkable interface: returns the name of the node.     */    public String getNodeName()    {	return "varexpr";    }    /**     * Walkable interface: returns the number of neighbors.     */    public int getNeighborCount()    {        return 1;    }    /**     * Walkable interface: returns the specified neighbor: 0, left operand; 1,     * right operand if operation is binary.     */    public Object getNeighbor(int index)    {	if (index == 0)	    return var;	return null;    }    public String PPrint(int indent, boolean recursive)    {        String output = new String();        for(int i=0;i<indent;i++) output += " ";        output += "(var_expr\n";        if (recursive) output += var.PPrint(indent+2, true);        for(int i=0;i<indent;i++) output += " ";        output += ") /* var_expr */\n";        return output;    }}

⌨️ 快捷键说明

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