|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectantlr.TreeParser
dspl.frontend.DSPLAstToIntermediateWalker
public class DSPLAstToIntermediateWalker
This class is the tree walker which walks the AST for a dspl file and produces an intermediate representation.
| Field Summary | |
|---|---|
static java.lang.String[] |
_tokenNames
|
static antlr.collections.impl.BitSet |
_tokenSet_0
|
static antlr.collections.impl.BitSet |
_tokenSet_1
|
protected boolean |
arrayop
|
protected int |
arraysize
Functions that Assist in Semantic Anaylsis or Array operations |
(package private) boolean |
convert
|
(package private) int |
indexCount
|
(package private) InstructionSet |
iSet
|
(package private) int |
nextTempNumber
|
(package private) int |
rightType
|
(package private) SymbolTable |
table
|
| Fields inherited from class antlr.TreeParser |
|---|
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth |
| Fields inherited from interface dspl.frontend.DSPLAstToIntermediateWalkerTokenTypes |
|---|
ASSIGN, COMMA, COMMENT, DECLS, DIGITS, DIV, DOT, EOF, EQ, GE, GT, ID, LBRACE, LBRACK, LE, LITERAL_byte, LITERAL_byte_array, LITERAL_ccall, LITERAL_complex, LITERAL_complex_array, LITERAL_else, LITERAL_float, LITERAL_float_array, LITERAL_for, LITERAL_if, LITERAL_int, LITERAL_int_array, LITERAL_string, LITERAL_ubyte, LITERAL_ubyte_array, LITERAL_uint, LITERAL_uint_array, LITERAL_while, LPAREN, LT, MINUS, MUL, NE, NEGATE, NEWLINE, NULL_TREE_LOOKAHEAD, NUM, PLUS, PROGRAM, RBRACE, RBRACK, REAL, RPAREN, SEMI, STRING, TILDE, WS |
| Constructor Summary | |
|---|---|
DSPLAstToIntermediateWalker()
|
|
| Method Summary | |
|---|---|
protected void |
arrayOperationEnter()
|
protected void |
arrayOperationExit()
|
Comparison |
bool(antlr.collections.AST _t)
|
java.lang.String |
ccallname(antlr.collections.AST _t)
ccallname is unlike other instances of ID because we don't want a variable, we just want the name of the function! |
protected int |
checkLogical(Variable e1,
Variable e2,
antlr.collections.AST _t)
Functions to aid in Semantic checking of logical expressions |
void |
decls(antlr.collections.AST _t)
We construct the symbol table outside of the tree walker, so we don't actually do anything for the declarations that we find here |
protected void |
decrementIndexCount()
|
protected void |
disableConversion()
|
Variable |
expr(antlr.collections.AST _t)
|
protected int |
findType(int dataType)
|
protected int |
getSize()
|
SymbolTable |
getSymbolTable()
|
protected Variable |
getTempAtomicVar(int variableType,
java.lang.String prepend)
Helper function intended to be used by expressions which require a temporary variable to store a result variableType must correspond to one of the Variable.DATATYPE_xxx (int/uint/float/etc) |
protected void |
incrementIndexCount()
Series of helper functions for conversion analysis |
protected boolean |
isArrayOp()
|
protected boolean |
isIndex()
|
private static long[] |
mk_tokenSet_0()
|
private static long[] |
mk_tokenSet_1()
|
protected boolean |
needsConversion(int dataType)
|
protected Variable |
newFloatConstant(java.lang.String val)
Function that creates a new Float "Constant" (since its stored in the symbol table) |
InstructionSet |
program(antlr.collections.AST _t)
The program rule is the one that...matches the whole program, represented by the root node of the AST. |
protected void |
setConversion(int conversionType)
|
protected void |
setSize(int size)
|
Instruction |
stmt(antlr.collections.AST _t)
a statements can be one of many types, and an appropriate instruction needs to be appended to the current InstructionSet based on what needs to be done |
Instruction |
stmts(antlr.collections.AST _t)
stmts is simply a sequence of statments |
Instruction |
subprog(antlr.collections.AST _t)
|
protected boolean |
validArrayOperation(int size)
|
| Methods inherited from class antlr.TreeParser |
|---|
getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, panic, reportError, reportError, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
InstructionSet iSet
SymbolTable table
int nextTempNumber
int rightType
boolean convert
int indexCount
protected int arraysize
protected boolean arrayop
public static final java.lang.String[] _tokenNames
public static final antlr.collections.impl.BitSet _tokenSet_0
public static final antlr.collections.impl.BitSet _tokenSet_1
| Constructor Detail |
|---|
public DSPLAstToIntermediateWalker()
| Method Detail |
|---|
public SymbolTable getSymbolTable()
protected Variable getTempAtomicVar(int variableType,
java.lang.String prepend)
throws SemanticAnalysisException
SemanticAnalysisExceptionprotected void incrementIndexCount()
protected void decrementIndexCount()
protected boolean isIndex()
protected void setConversion(int conversionType)
protected void disableConversion()
protected int findType(int dataType)
protected boolean needsConversion(int dataType)
protected Variable newFloatConstant(java.lang.String val)
throws SemanticAnalysisException
SemanticAnalysisExceptionprotected void setSize(int size)
protected int getSize()
protected boolean validArrayOperation(int size)
protected void arrayOperationEnter()
protected void arrayOperationExit()
protected boolean isArrayOp()
protected int checkLogical(Variable e1,
Variable e2,
antlr.collections.AST _t)
throws SemanticAnalysisException
SemanticAnalysisException
public final InstructionSet program(antlr.collections.AST _t)
throws antlr.RecognitionException,
SemanticAnalysisException,
SymbolicException
antlr.RecognitionException
SemanticAnalysisException
SymbolicException
public final void decls(antlr.collections.AST _t)
throws antlr.RecognitionException
antlr.RecognitionException
public final Instruction stmts(antlr.collections.AST _t)
throws antlr.RecognitionException,
SemanticAnalysisException,
SymbolicException
antlr.RecognitionException
SemanticAnalysisException
SymbolicException
public final Instruction stmt(antlr.collections.AST _t)
throws antlr.RecognitionException,
SemanticAnalysisException,
SymbolicException
antlr.RecognitionException
SemanticAnalysisException
SymbolicException
public final Variable expr(antlr.collections.AST _t)
throws antlr.RecognitionException,
SemanticAnalysisException,
SymbolicException
antlr.RecognitionException
SemanticAnalysisException
SymbolicException
public final java.lang.String ccallname(antlr.collections.AST _t)
throws antlr.RecognitionException
antlr.RecognitionException
public final Comparison bool(antlr.collections.AST _t)
throws antlr.RecognitionException,
SemanticAnalysisException,
SymbolicException
antlr.RecognitionException
SemanticAnalysisException
SymbolicException
public final Instruction subprog(antlr.collections.AST _t)
throws antlr.RecognitionException,
SemanticAnalysisException,
SymbolicException
antlr.RecognitionException
SemanticAnalysisException
SymbolicExceptionprivate static final long[] mk_tokenSet_0()
private static final long[] mk_tokenSet_1()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||