Knowledge

Symbol table

Source 📝

43: 310:. If a module is found that defines that symbol it is linked together with the first object file, and any undefined external identifiers are added to the list of identifiers to be looked up. This process continues until all external references have been resolved. It is an error if one or more remains unresolved at the end of the process. 1187:
The symbol types in the SysV ABI (and nm's output) indicate the nature of each entry in the symbol table. Each symbol type is represented by a single character. For example, symbol table entries representing initialized data are denoted by the character "d" and symbol table entries for functions have
285:
As the lexical analyser spends a great proportion of its time looking up the symbol table, this activity has a crucial effect on the overall speed of the compiler. A symbol table must be organised in such a way that entries can be found as quickly as possible. Hash tables are usually used to organise
274:
a symbol "p" can be declared separately in several procedures, perhaps with different attributes. The scope of each declaration is the section of the program in which references to "p" resolve to that declaration. Each declaration represents a unique identifier "p". The symbol table must have some
282:. The time for searching in hash tables is independent of the number of elements stored in the table, so it is efficient for a large number of elements. It also simplifies the classification of literals in tabular format by including the classification in calculation of the hash key. 226:(IR) includes the symbol's name and its location or address. For a compiler targeting a platform with a concept of relocatability, it will also contain relocatability attributes (absolute, relocatable, etc.) and needed relocation information for relocatable symbols. Symbol tables for 1192:
section of an object file). Additionally, the capitalization of the symbol type indicates the type of linkage: lower-case letters indicate the symbol is local and upper-case indicates external (global) linkage.
230:
may store the symbol's type: string, integer, floating-point, etc., its size, and its dimensions and its bounds. Not all of this information is included in the output file, but may be provided for use in
239:
information is stored with or linked to the symbol table. Most compilers print some or all of this information in symbol table and cross-reference listings at the end of translation.
317:
an executable, many tools refer to the symbol table to check what addresses have been assigned to global variables and known functions. If the symbol table has been
1205:
programming language includes extensive support for creating and manipulating symbol tables. Properties that can be queried include whether a given symbol is a
1170:
are to be laid out in a binary file, so that different compilers, linkers and loaders can all consistently find and work with the symbols in a compiled object.
580:
In addition, the symbol table may also contain entries generated by the compiler for intermediate expression values (e.g., the expression that casts the
321:
or cleaned out before being converted into an executable, tools will find it harder to determine addresses or understand anything about the program.
199:
A symbol table may only exist in memory during the translation process, or it may be embedded in the output of the translation, such as in an
191:
or appearance in the source. In other words, the entries of a symbol table store the information related to the entry's corresponding symbol.
302:
will contain a symbol table of the identifiers it contains that are externally visible. During the linking of different object files, a
290:
are inevitable in a hash table, and a common way of handling them is to store the synonym in the next available free space in the table.
306:
will identify and resolve these symbol references. Usually all undefined external symbols will be searched for in one or more
1457: 1233:
Some programming languages allow the symbol table to be manipulated at run-time, so that symbols can be added at any time.
107: 79: 262:
A compiler may use one large symbol table for all symbols or use separated, or hierarchical symbol tables for different
255:
can all be used to implement a symbol table. The symbol table is accessed by most phases of a compiler, beginning with
188: 17: 126: 86: 1423: 227: 172: 164: 64: 93: 1245: 1234: 1202: 176: 60: 1484: 1163: 200: 223: 75: 1406: 1268: 330: 160: 53: 1357: 152: 1255:
programming language is essentially a symbol-table manipulation language; symbols are called
1248:
programming languages allow arbitrary, generic properties to be associated with each symbol.
484:
A C compiler that parses this code will contain at least the following symbol table entries:
211: 1174: 1167: 286:
a symbol table, where the keyword or identifier is 'hashed' to produce an array subscript.
252: 168: 31: 100: 8: 314: 307: 263: 1463: 303: 1394: 1453: 1467: 1445: 256: 140: 1382: 1441: 1321: 236: 1210: 1181: 287: 248: 148: 27:
Data structure used by a language translator such as a compiler or Interpreter
1478: 1206: 222:
The minimum information contained in a symbol table used by a translator and
1449: 1280: 1218: 318: 1259:, and the relationships between symbols can be reasoned over. Similarly, 1285: 1214: 733: 299: 203: 184: 1184:
field, a "symbol type" field, and a symbol identifier (called "Name").
279: 180: 210:, or as a resource for formatting a diagnostic report during or after 1222: 1177: 232: 42: 1437: 207: 206:
for later use. For example, it might be used during an interactive
156: 1429: 1260: 1252: 1188:
the symbol type "t" (because executable code is located in the
278:
A common data structure used to implement symbol tables is the
251:
are available for implementing tables. Trees, linear lists and
1303: 1301: 1433: 267: 30:"Symbol (computing)" redirects here. For the data type, see 1338: 1298: 1241: 1160: 275:
means of differentiating references to the different "p"s.
271: 1422:
Copper, Keith D.; Torczon, Linda (18 January 2011).
1196: 67:. Unsourced material may be challenged and removed. 1228: 1159:An example of a symbol table can be found in the 1476: 588:, and the return value of the call to function 187:is associated with information relating to its 1421: 1344: 1307: 1263:provides a dynamic symbol table, called the 266:. For example, in a scoped language such as 401:// Sum all the values bar(1) to bar(count) 329:Consider the following program written in 127:Learn how and when to remove this message 1166:(ABI) specification, which mandates how 259:, and continuing through optimization. 14: 1477: 1319: 1180:utility. This format uses a sorted 595: 65:adding citations to reliable sources 36: 1221:, whether it is imported, and what 1173:The SysV ABI is implemented in the 592:), statement labels, and so forth. 24: 1237:is an example of such a language. 25: 1496: 242: 1197:Example: the Python symbol table 228:high-level programming languages 41: 1415: 338:// Declare an external function 293: 52:needs additional citations for 1399: 1387: 1375: 1350: 1313: 1229:Example: Dynamic symbol tables 235:. In many cases, the symbol's 217: 13: 1: 1291: 194: 1164:Application Binary Interface 7: 1274: 362:// Define a public function 224:intermediate representation 10: 1501: 324: 29: 1345:Copper & Torczon 2011 1308:Copper & Torczon 2011 1269:knowledge representation 601:Example table: SysV ABI 335: 1450:10.1016/C2009-0-27982-7 1425:Engineering a Compiler 900:AT91F_US_SetTimeguard 779:AT91F_SpuriousHandler 711:AT91F_US3_CfgPIO_useB 1320:Nguyen, Binh (2004). 878:AT91F_US_SetBaudrate 584:loop variable into a 253:self-organizing lists 1395:Racket Documentation 1383:Python documentation 1267:, which is used for 955:AT91F_PDC_SetNextRx 944:AT91F_PDC_SetNextTx 933:AT91F_PDC_DisableTx 922:AT91F_PDC_DisableRx 856:AT91F_PIO_CfgPeriph 722:AT91F_PIO_CfgPeriph 61:improve this article 32:Symbol (programming) 1485:Compiler structures 1407:Guile Documentation 999:AT91F_PDC_EnableTx 988:AT91F_PDC_EnableRx 867:AT91F_US_Configure 834:AT91F_LowLevelInit 823:AT91F_UndefHandler 602: 574:for-loop statement 548:function parameter 522:function parameter 315:reverse engineering 151:used by a language 1010:AT91F_US_EnableTx 889:AT91F_US_Baudrate 845:AT91F_DBGU_CfgPIO 746:AT91F_DBGU_Printk 600: 18:Symbol (computing) 1459:978-0-12-088478-0 1157: 1156: 1043:__aeabi_uidivmod 801:AT91F_FetchAbort 768:AT91F_US_PutChar 757:AT91F_US_TxReady 596:Example: SysV ABI 578: 577: 208:debugging session 137: 136: 129: 111: 16:(Redirected from 1492: 1471: 1409: 1403: 1397: 1391: 1385: 1379: 1373: 1372: 1370: 1368: 1354: 1348: 1342: 1336: 1335: 1333: 1331: 1323:Linux Dictionary 1317: 1311: 1305: 1213:, whether it is 977:AT91F_PDC_SetRx 966:AT91F_PDC_SetTx 790:AT91F_DataAbort 603: 599: 591: 587: 583: 568: 555: 542: 532:function, double 529: 516: 506:function, double 503: 487: 486: 480: 477: 474: 471: 468: 465: 462: 459: 456: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 423: 420: 417: 414: 411: 408: 405: 402: 399: 396: 393: 390: 387: 384: 381: 378: 375: 372: 369: 366: 363: 360: 357: 354: 351: 348: 345: 342: 339: 308:object libraries 257:lexical analysis 141:computer science 132: 125: 121: 118: 112: 110: 69: 45: 37: 21: 1500: 1499: 1495: 1494: 1493: 1491: 1490: 1489: 1475: 1474: 1460: 1442:Rice University 1418: 1413: 1412: 1404: 1400: 1392: 1388: 1380: 1376: 1366: 1364: 1356: 1355: 1351: 1343: 1339: 1329: 1327: 1318: 1314: 1306: 1299: 1294: 1277: 1231: 1225:it belongs to. 1199: 911:AT91F_PDC_Open 598: 589: 585: 581: 566: 553: 540: 527: 514: 501: 482: 481: 478: 475: 472: 469: 466: 463: 460: 457: 454: 451: 448: 445: 442: 439: 436: 433: 430: 427: 424: 421: 418: 415: 412: 409: 406: 403: 400: 397: 394: 391: 388: 385: 382: 379: 376: 373: 370: 367: 364: 361: 358: 355: 352: 349: 346: 343: 340: 337: 327: 296: 249:data structures 245: 237:cross-reference 220: 197: 183:in a program's 133: 122: 116: 113: 70: 68: 58: 46: 35: 28: 23: 22: 15: 12: 11: 5: 1498: 1488: 1487: 1473: 1472: 1458: 1428:(2 ed.). 1417: 1414: 1411: 1410: 1398: 1386: 1374: 1362:sourceware.org 1349: 1347:, p. 254. 1337: 1326:. p. 1482 1312: 1310:, p. 253. 1296: 1295: 1293: 1290: 1289: 1288: 1283: 1276: 1273: 1230: 1227: 1211:bound variable 1198: 1195: 1182:memory address 1155: 1154: 1151: 1148: 1144: 1143: 1140: 1137: 1133: 1132: 1131:__bss_start__ 1129: 1126: 1122: 1121: 1118: 1115: 1111: 1110: 1107: 1104: 1100: 1099: 1096: 1093: 1089: 1088: 1085: 1082: 1078: 1077: 1074: 1071: 1067: 1066: 1065:__aeabi_ldiv0 1063: 1060: 1056: 1055: 1054:__aeabi_idiv0 1052: 1049: 1045: 1044: 1041: 1038: 1034: 1033: 1030: 1027: 1023: 1022: 1021:__aeabi_uidiv 1019: 1016: 1012: 1011: 1008: 1005: 1001: 1000: 997: 994: 990: 989: 986: 983: 979: 978: 975: 972: 968: 967: 964: 961: 957: 956: 953: 950: 946: 945: 942: 939: 935: 934: 931: 928: 924: 923: 920: 917: 913: 912: 909: 906: 902: 901: 898: 895: 891: 890: 887: 884: 880: 879: 876: 873: 869: 868: 865: 862: 858: 857: 854: 851: 847: 846: 843: 840: 836: 835: 832: 829: 825: 824: 821: 818: 814: 813: 810: 807: 803: 802: 799: 796: 792: 791: 788: 785: 781: 780: 777: 774: 770: 769: 766: 763: 759: 758: 755: 752: 748: 747: 744: 741: 737: 736: 731: 728: 724: 723: 720: 717: 713: 712: 709: 706: 702: 701: 698: 695: 691: 690: 687: 684: 680: 679: 676: 673: 669: 668: 665: 662: 658: 657: 654: 651: 647: 646: 643: 640: 636: 635: 632: 629: 625: 624: 621: 618: 614: 613: 610: 607: 597: 594: 576: 575: 572: 569: 563: 562: 559: 556: 550: 549: 546: 543: 537: 536: 533: 530: 524: 523: 520: 517: 511: 510: 507: 504: 498: 497: 494: 491: 336: 326: 323: 295: 292: 244: 243:Implementation 241: 219: 216: 214:of a program. 196: 193: 149:data structure 135: 134: 76:"Symbol table" 49: 47: 40: 26: 9: 6: 4: 3: 2: 1497: 1486: 1483: 1482: 1480: 1469: 1465: 1461: 1455: 1451: 1447: 1443: 1439: 1435: 1431: 1427: 1426: 1420: 1419: 1408: 1402: 1396: 1390: 1384: 1378: 1363: 1359: 1353: 1346: 1341: 1325: 1324: 1316: 1309: 1304: 1302: 1297: 1287: 1284: 1282: 1279: 1278: 1272: 1270: 1266: 1262: 1258: 1254: 1249: 1247: 1243: 1238: 1236: 1226: 1224: 1220: 1216: 1212: 1208: 1207:free variable 1204: 1194: 1191: 1185: 1183: 1179: 1176: 1175:GNU binutils' 1171: 1169: 1165: 1162: 1152: 1149: 1146: 1145: 1141: 1138: 1135: 1134: 1130: 1127: 1124: 1123: 1119: 1116: 1113: 1112: 1108: 1105: 1102: 1101: 1097: 1094: 1091: 1090: 1086: 1083: 1080: 1079: 1075: 1072: 1069: 1068: 1064: 1061: 1058: 1057: 1053: 1050: 1047: 1046: 1042: 1039: 1036: 1035: 1031: 1028: 1025: 1024: 1020: 1017: 1014: 1013: 1009: 1006: 1003: 1002: 998: 995: 992: 991: 987: 984: 981: 980: 976: 973: 970: 969: 965: 962: 959: 958: 954: 951: 948: 947: 943: 940: 937: 936: 932: 929: 926: 925: 921: 918: 915: 914: 910: 907: 904: 903: 899: 896: 893: 892: 888: 885: 882: 881: 877: 874: 871: 870: 866: 863: 860: 859: 855: 852: 849: 848: 844: 841: 838: 837: 833: 830: 827: 826: 822: 819: 816: 815: 811: 808: 805: 804: 800: 797: 794: 793: 789: 786: 783: 782: 778: 775: 772: 771: 767: 764: 761: 760: 756: 753: 750: 749: 745: 742: 739: 738: 735: 732: 729: 726: 725: 721: 718: 715: 714: 710: 707: 704: 703: 699: 696: 693: 692: 688: 685: 682: 681: 677: 674: 671: 670: 666: 663: 660: 659: 655: 652: 649: 648: 644: 641: 638: 637: 633: 630: 627: 626: 622: 619: 616: 615: 611: 608: 605: 604: 593: 573: 570: 565: 564: 560: 557: 552: 551: 547: 544: 539: 538: 534: 531: 526: 525: 521: 518: 513: 512: 508: 505: 500: 499: 495: 492: 489: 488: 485: 334: 332: 322: 320: 316: 311: 309: 305: 301: 291: 289: 283: 281: 276: 273: 269: 265: 260: 258: 254: 250: 240: 238: 234: 229: 225: 215: 213: 209: 205: 202: 192: 190: 186: 182: 178: 174: 170: 166: 163:, where each 162: 158: 154: 150: 146: 142: 131: 128: 120: 117:November 2012 109: 106: 102: 99: 95: 92: 88: 85: 81: 78: –  77: 73: 72:Find sources: 66: 62: 56: 55: 50:This article 48: 44: 39: 38: 33: 19: 1424: 1416:Bibliography 1401: 1389: 1377: 1365:. Retrieved 1361: 1352: 1340: 1328:. Retrieved 1322: 1315: 1281:Debug symbol 1264: 1256: 1250: 1239: 1232: 1219:global scope 1200: 1189: 1186: 1172: 1158: 1120:__bss_start 1109:__bss_end__ 812:AT91F_Undef 579: 561:block local 490:Symbol name 483: 328: 312: 297: 294:Applications 284: 277: 261: 246: 221: 198: 145:symbol table 144: 138: 123: 114: 104: 97: 90: 83: 71: 59:Please help 54:verification 51: 1381:symtable — 1286:.debug_info 1215:block scope 300:object file 218:Description 204:object file 189:declaration 185:source code 161:interpreter 1405:Symbols - 1393:Symbols - 1292:References 1032:__udivsi3 678:InitReset 288:Collisions 280:hash table 195:Background 165:identifier 155:such as a 153:translator 87:newspapers 1265:atomspace 1240:Both the 1223:namespace 247:Numerous 233:debugging 212:execution 177:procedure 1479:Category 1468:40425497 1438:Elsevier 1275:See also 1244:and the 1147:200009a4 1136:200009a4 1125:200009a4 1114:200009a4 1103:200009a4 1092:200009a0 1081:200009a0 1070:2000089c 1059:2000089c 1048:2000089c 1037:20000884 1026:20000788 1015:20000788 1004:2000075c 993:20000730 982:20000704 971:200006c0 960:2000067c 949:20000638 938:200005f4 927:200005c8 916:2000059c 905:2000051c 894:200004ec 883:2000041c 872:200003dc 861:20000360 850:2000030c 839:200002e0 828:20000284 817:20000268 806:2000024c 795:20000230 784:20000214 773:200001f8 762:200001c0 751:20000190 740:20000120 727:200000b0 716:2000005c 705:20000030 694:20000024 683:20000018 672:2000000c 661:20000008 650:20000004 639:00000080 628:00000040 617:00000020 319:stripped 181:function 173:constant 157:compiler 1430:Houston 1367:May 30, 1330:Apr 14, 1261:OpenCog 1168:symbols 1142:_edata 1098:_etext 1076:__div0 667:fiqvec 656:irqvec 606:Address 535:global 509:extern 325:Example 101:scholar 1466:  1456:  1253:Prolog 1246:Scheme 1235:Racket 1203:Python 1087:_data 689:_main 645:I_BIT 634:F_BIT 623:T_BIT 586:double 558:double 519:double 496:Scope 470:return 458:double 386:double 365:double 353:double 344:double 341:extern 313:While 304:linker 264:scopes 169:symbol 103:  96:  89:  82:  74:  1464:S2CID 1434:Texas 1257:atoms 1209:or a 1153:_end 612:Name 590:bar() 541:count 493:Type 431:count 428:<= 377:count 268:Algol 147:is a 108:JSTOR 94:books 1454:ISBN 1369:2020 1358:"nm" 1332:2018 1251:The 1242:LISP 1201:The 1190:text 1161:SysV 734:main 700:End 609:Type 272:PL/I 179:and 167:(or 143:, a 80:news 1446:doi 1217:or 571:int 554:sum 545:int 528:foo 502:bar 473:sum 452:bar 446:sum 410:int 404:for 395:0.0 389:sum 374:int 368:foo 347:bar 298:An 270:or 201:ABI 171:), 159:or 139:In 63:by 1481:: 1462:. 1452:. 1444:. 1440:, 1436:: 1432:, 1360:. 1300:^ 1271:. 1178:nm 467:); 455:(( 449:+= 440:++ 359:); 333:: 175:, 1470:. 1448:: 1371:. 1334:. 1150:A 1139:A 1128:A 1117:A 1106:A 1095:A 1084:D 1073:T 1062:T 1051:T 1040:T 1029:T 1018:T 1007:t 996:t 985:t 974:t 963:t 952:t 941:t 930:t 919:t 908:t 897:t 886:t 875:t 864:t 853:t 842:t 831:T 820:T 809:T 798:T 787:T 776:T 765:t 754:t 743:T 730:T 719:t 708:T 697:t 686:T 675:t 664:t 653:t 642:a 631:a 620:a 582:i 567:i 515:x 479:} 476:; 464:i 461:) 443:) 437:i 434:; 425:i 422:; 419:1 416:= 413:i 407:( 398:; 392:= 383:{ 380:) 371:( 356:x 350:( 331:C 130:) 124:( 119:) 115:( 105:· 98:· 91:· 84:· 57:. 34:. 20:)

Index

Symbol (computing)
Symbol (programming)

verification
improve this article
adding citations to reliable sources
"Symbol table"
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
computer science
data structure
translator
compiler
interpreter
identifier
symbol
constant
procedure
function
source code
declaration
ABI
object file
debugging session
execution
intermediate representation

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.