|
CS 536 Fall 2007, Project 5 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectASTNode
ExprNode
SimpleExprNode
public class SimpleExprNode
An AST node representing a simple expression with syntax "id" or "id(expr,...,expr)". The expression may represent either a function call or a (possibly subscripted) variable reference depending on the declared type of "id".
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ASTNode |
---|
ASTNode.Opcode |
Field Summary |
---|
Fields inherited from class ExprNode |
---|
column, line, type |
Constructor Summary | |
---|---|
SimpleExprNode(IdNode id,
List<ExprNode> args)
Creates a new SimpleExprNode. |
Method Summary | |
---|---|
void |
codeGen(int reg)
Generates code to load the value of this expression into a register. |
void |
codeGenLValue(int reg)
Generates code to load the lvalue of this expression into a register. |
boolean |
isLValue()
Tests whether this SimpleExprNode represents something that may be on the left-hand-side of an assignment, or passed to an OUT or INOUT parameter of a procedure or function. |
static boolean |
isLValue(ExprNode exp)
Convenience function to test whether an arbitrary ExprNode is an LValue. |
void |
resolveNames(SymbolTable symtab)
Resolves all applied uses of identifiers in the tree rooted at this node. |
void |
resolveTypes(ProcDeclNode proc)
Fills in types for all Symbols bound to IdNodes. |
void |
unparse(PrintWriter p,
int level)
Prints a source representation of the tree rooted at this node on output stream p. |
Methods inherited from class ExprNode |
---|
codeGen |
Methods inherited from class ASTNode |
---|
indent, toString |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SimpleExprNode(IdNode id, List<ExprNode> args)
id
- the name of the function or variable.args
- the list of arguments or subscripts. May be a zero-length
list, but must not be null.Method Detail |
---|
public boolean isLValue()
public static boolean isLValue(ExprNode exp)
exp
- an arbitrary expression.
public void unparse(PrintWriter p, int level)
unparse
in class ASTNode
p
- the place to display the output.level
- the number of levels of indentation to use if the output
requires more than one line.public void resolveNames(SymbolTable symtab)
resolveNames
in class ASTNode
symtab
- the symbol table to be used.public void resolveTypes(ProcDeclNode proc)
resolveTypes
in class ASTNode
proc
- the smallest enclosing procedure or function declaration.public void codeGen(int reg)
codeGen
in class ExprNode
reg
- the number of the s register where the result should be
placed.public void codeGenLValue(int reg)
reg
- the number of the s register where the result should be
placed.
|
CS 536 Fall 2007, Project 5 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |