Com 212 intro to system programming book Theory


BUILDING THE SYMBOL TABLE PASS 1



Download 0.65 Mb.
View original pdf
Page33/72
Date13.05.2021
Size0.65 Mb.
#56617
1   ...   29   30   31   32   33   34   35   36   ...   72
com-212-introduction-to-system-programming-theory
9833 SS1 FISHERY LESSON NOTE

BUILDING THE SYMBOL TABLE PASS 1
During pass 1, the input is read and memory addresses are assigned to program labels. Memory is allocated sequentially so that the pass 1 module can use a location counter. For each input statement, this counter is incremented by the size of memory allocated. Whenever a label is encountered, it is recorded in the symbol table. The address assigned is the value of the location counter at the beginning of the statement. Most assemblers need to do some processing of assembler directives to determine the size of the data involved. Modern RISC processors have fixed instruction lengths, so machine instructions require very little processing during pass 1. Some assemblers keep data and instructions in separate regions of memory. If this is done then two separate location counters are used, one for data and one for instructions. The symbol table could be treated as a sub-module of the pass 1 module. This choice has little if any effect on the complexity of coding, but a separately compiled sub-module does facilitate separate testing.

Download 0.65 Mb.

Share with your friends:
1   ...   29   30   31   32   33   34   35   36   ...   72




The database is protected by copyright ©ininet.org 2024
send message

    Main page