public class Symbol extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Symbol.MemLoc
Memory access locations.
|
Modifier and Type | Field and Description |
---|---|
int |
elementSize
Size of individual elements (in bytes)
|
boolean |
isArray
Flag indicating this symbol represents an array
|
int |
length
Length of array (for array symbols; should be 1 for others)
|
Symbol.MemLoc |
location
Memory location information
|
String |
name
Name in source code
|
int |
offset
Memory offset (if needed)
|
List<ASTNode.DataType> |
paramTypes
Data types of formal parameters (for function symbols, empty for others)
|
int |
totalSize
Size of overall structure (in bytes); for scalar variables,
elementSize == totalSize
|
ASTNode.DataType |
type
Data type
|
static int |
WORD_SIZE
Word size (used for some data types and addresses)
|
Constructor and Description |
---|
Symbol(String name,
ASTNode.DataType type)
Create a new scalar symbol
|
Symbol(String name,
ASTNode.DataType type,
boolean isArray,
int length)
Create a new array symbol
|
Symbol(String name,
ASTNode.DataType returnType,
List<ASTNode.DataType> paramTypes)
Create a new function symbol
|
public static final int WORD_SIZE
public String name
public ASTNode.DataType type
public List<ASTNode.DataType> paramTypes
public boolean isArray
public int length
public int elementSize
public int totalSize
public Symbol.MemLoc location
public int offset
public Symbol(String name, ASTNode.DataType type)
name
- Name in source codetype
- Data type (ASTNode.DataType
)public Symbol(String name, ASTNode.DataType type, boolean isArray, int length)
name
- Name in source codeisArray
- Flag indicating whether the symbol represents an array or scalartype
- Data type (ASTNode.DataType
)length
- Array length (should be 1 for scalar)public Symbol(String name, ASTNode.DataType returnType, List<ASTNode.DataType> paramTypes)
name
- Name in source codereturnType
- Function return type (ASTNode.DataType
)paramTypes
- List of formal parameter data typesCopyright © 2019. All rights reserved.