|
CS 536 Fall 2007, Project 5 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
ObjectASTNode
DeclNode
VarDeclNode
public class VarDeclNode
An AST node representing a variable declaration: "id : type;" or "id : ARRAY (INT DOTDOT INT) OF type;".
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class ASTNode |
|---|
ASTNode.Opcode |
| Field Summary |
|---|
| Fields inherited from class DeclNode |
|---|
enclosingProc |
| Constructor Summary | |
|---|---|
VarDeclNode(IdNode id,
Type.BaseType type)
Creates a new VarDeclNode for a scalar declaration. |
|
VarDeclNode(IdNode id,
Type.BaseType type,
int lower,
int upper)
Creates a new VarDeclNode for an array declaration. |
|
| Method Summary | |
|---|---|
void |
codeGen(StmtNode loop)
Generates code for this node and all descendants. |
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 ASTNode |
|---|
indent, toString |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public VarDeclNode(IdNode id,
Type.BaseType type,
int lower,
int upper)
id - the name of the variable.type - the type appearing in the declaration.lower - the lower bound in the declaration.upper - the upper bound in the declaration.
public VarDeclNode(IdNode id,
Type.BaseType type)
id - the name of the variable.type - the type appearing in the declaration.| Method Detail |
|---|
public void unparse(PrintWriter p,
int level)
unparse in class ASTNodep - 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 ASTNodesymtab - the symbol table to be used.public void resolveTypes(ProcDeclNode proc)
resolveTypes in class ASTNodeproc - the smallest enclosing procedure or function declaration.public void codeGen(StmtNode loop)
codeGen in class DeclNodeloop - the smallest enclosing ForStmtNode or WhileStmtNode, if any.
|
CS 536 Fall 2007, Project 5 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||