Another solution of scoping problems in symbol tables
The central task of symbol table administration is identification of all identifiers used in the source program under consideration of visibility rules varying between the different programming languages. Usually this problem is handled by a hash search of the identifier and an additional decision about the visibility of this identifier in the current program region (“scoping problem”). The most used solution for the scoping problem is scope-dependent switching of hash links in such a way that only such identifiers indeed visible in this region are reachable by the hashing process.
The new approach handles the scoping problem by visibility sets defined for every program region, and additionally by overload resolution tables for multiple used identifier names. The result is constant decision time for the scoping problem (at latest) after the first access to an identifier in a program region. The algorithm is very simple so that the access time is not only (nearly) constant but also very small. The approach permits an efficient solution of all the scoping problems of contemporary programming languages such as MODULA-2, C, or Fortran90.
KeywordsProgram Region Abstract Data Type Hash Chain Symbol Table Scope Problem
- 1.P. Fritzson: Incremental Symbol Processing. Research Report LiTH-IDA-R-88-09, Linköping University, Sweden, 1988Google Scholar
- 2.L.B. Geissmann: Separate Compilation in Modula-2 and the Structure of the Modula-2 Compiler on the Personal Computer Lilith. ETH Zürich, Diss. ETH No. 7286, 1983Google Scholar
- 3.S.L. Graham, W.N. Joy, O. Roubine: Hashed Symbol Tables for Languages with Explicit Scope Control. SIGPLAN Notices 14 (Aug. 1979), 50–57Google Scholar
- 4.R.T. House: Alternative Scope Rules for Block-Structured Languages. The Computer Journal 29 (1986) 3, 253–260Google Scholar
- 5.U. Kastens, W.M. Waite: An Abstract Data Type for Name Analysis. Research Report CU-CS-460-90, University of Colorado at Boulder, March, 1990Google Scholar
- 6.Masato Takeichi: Name Identification for Languages with Explicit Scope Control. Journal of Information Processing 5 (1982) 1, 45–49Google Scholar
- 7.W.M. Waite, G. Goos: Compiler Construction. Springer Verlag, New York, 1984Google Scholar