Home
 

Project Report

Chapter 4. Project Report

Symbol Creation

A declaration is defined as follows (see the section called parser.y in Appendix B).

Declaration:
    IdentifierSeq COLONTK DataType
        {$$ = new DeclarationCls($1, $3, textline);}


The constructor of DeclarationCls then iterates over the IdenfifierSeq. For each identifier we do the following. First, look if it is already in the symbol table and output an error if so. If not, then allocate memory for the identifier with the memory management class MMCls. The required size is determined by the DataType, which is stored in a DataTypeCls. The symbol is finally inserted into the symbol table.