3.2 Symbol Tables and a Scanner
Though as suggested above and in Figs. 3.1 and 3.2, Symbol Tables are created during the Scanner phase of a compiler, their real use and manipulations will be needed during the semantic analysis phase and as such we postpone full discussion of Symbol Table handling techniques till Section 5.5 in Chapter 5. However, the Scanner does initiate building up of the Symbol Table and here we discuss building a skeleton Symbol Table, with whatever information is available with the Scanner.
A general discussion about Symbol Tables is given in Appendix B, Section B.2.3.
In anticipation of later developments, we build the Symbol Table as a binary search tree (BST). Though a BST can have worst-case search time as bad as a linked ...
Get Compilers: Principles and Practice now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.