coins.casttohir
Class ToHirSym

java.lang.Object
  extended bycoins.casttohir.ToHirSym
All Implemented Interfaces:
TypeId

public class ToHirSym
extends java.lang.Object
implements TypeId

Create symbol and register it to the symbol table.


Field Summary
protected  int fDbgLevel
           
 
Fields inherited from interface coins.ast.TypeId
ARRAY_T, CHAR_T, CONST_T, DOUBLE_T, ELLIPSIS_T, ENUM_BEGIN, ENUM_END, FLOAT_T, FUNCTION_T, INT_T, LONG_DOUBLE_T, LONG_LONG_T, LONG_T, NO_DIMENSION_T, OFFSET_T, POINTER_T, RESTRICT_T, RETURN_T, S_AUTO, S_EXTERN, S_INLINE, S_NONE, S_REGISTER, S_STATIC, SHORT_T, SIGNED_T, SIZE_T, STRUCT_BEGIN, STRUCT_END, UNION_BEGIN, UNION_END, UNSIGNED_T, VOID_T, VOLATILE_T
 
Constructor Summary
(package private) ToHirSym(ToHir tohir)
          Constructor.
 
Method Summary
 Type convertType(byte[] b, boolean pLocal)
          Convert type.
(package private)  Subp declareGlobalFunction(int storage, SubpType type, java.lang.String name, boolean init)
          Declare function at global scope.
(package private)  Var declareGlobalVariable(int storage, Type type, java.lang.String name, Expr ini)
          Declare variable at global scope.
(package private)  Subp declareLocalFunction(int storage, SubpType type, java.lang.String name)
          Declare function at local scope.
(package private)  Var declareLocalVariable(int storage, Type type, java.lang.String name, Expr ini)
          Declare variable at local scope.
(package private)  void declareType(Type type, java.lang.String name)
          Declare type (=typedef).
 SymTable getNormalTable()
          Get normal (block scope or global) symbol table other than SymTable owned by STRUCT, UNION, ENUM.
(package private)  void makeQualifiedTypes(Type t, java.lang.String tagname)
          make qualified types of t (=struct or union which has tag of tagname).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fDbgLevel

protected int fDbgLevel
Constructor Detail

ToHirSym

ToHirSym(ToHir tohir)
Constructor.

Parameters:
tohir - Offers cooperation with the object of other packages.
Method Detail

makeQualifiedTypes

void makeQualifiedTypes(Type t,
                        java.lang.String tagname)
make qualified types of t (=struct or union which has tag of tagname). The qualified type of t might be defined while t is an incomplete type. To define the qualified type of t as a complete type again when t became a complete type, this method is called.

Parameters:
t - complete type (struct or union)
tagname - tag name of the complete type

convertType

public Type convertType(byte[] b,
                        boolean pLocal)
Convert type. Created type symbol is added appropriate symbol table.

Parameters:
b - AST type information byte array.
Returns:
HIR type.

getNormalTable

public SymTable getNormalTable()
Get normal (block scope or global) symbol table other than SymTable owned by STRUCT, UNION, ENUM.

Returns:
Normal symbol table.

declareType

void declareType(Type type,
                 java.lang.String name)
Declare type (=typedef). Create type symbol and add into symTableCurrent.

Parameters:
type - Type of the symbol.
name - Name of the symbol.

declareGlobalFunction

Subp declareGlobalFunction(int storage,
                           SubpType type,
                           java.lang.String name,
                           boolean init)
Declare function at global scope. Create subprogram symbol and add into symTableRoot.

Parameters:
storage - AST storage class.
type - HIR SubpType object.
name - Function name.
init - True if declaration has function body.
Returns:
Declared Subp.

declareLocalFunction

Subp declareLocalFunction(int storage,
                          SubpType type,
                          java.lang.String name)
Declare function at local scope. Create subprogram symbol and add into symTableCurrent.

Parameters:
type - HIR SubpType object.
name - Function name.
Returns:
Declared Subp.

declareGlobalVariable

Var declareGlobalVariable(int storage,
                          Type type,
                          java.lang.String name,
                          Expr ini)
Declare variable at global scope. Create variable symbol and add into symTableRoot.

Parameters:
storage - AST storage class.
type - HIR Type object.
name - Variable name.
ini - Initializer.
Returns:
Declared Var.

declareLocalVariable

Var declareLocalVariable(int storage,
                         Type type,
                         java.lang.String name,
                         Expr ini)
Declare variable at local scope. Create variable symbol and add into symTableCurrent.

Parameters:
storage - AST storage class.
type - HIR Type object.
name - Variable name.
ini - Initializer.
Returns:
Declared Var.