Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SYMBOL TABLE ROUTINES Choose an organization for your symbol table- data structures for the identifier names and records-and write the FIND and INSERT routines. Put
SYMBOL TABLE ROUTINES Choose an organization for your symbol table- data structures for the identifier names and records-and write the FIND and INSERT routines. Put these routines into a dummy main program to prove that they work. Submit: (1) Symbol table routines (2) Test runs (input and output) Grading: Is the program correct? Is the program elegant? Well written? Is the program well tested? Important routines: FINDin CURRENT_SCOPE-1, FIND_IN ALL SCOPES-2, INSERT, DISPLAY Driver program: to test FIND (both versions), INSERT, DISPLAY, you need a driver (main) program that can: (1) open and close scopes, (2) check if a name is already in the symbol table (ST), and (3) add it into the ST if not already there. Requirements: identifiers must be stored without truncation, but also without wasting space. This probably means string allocation routines (although in some languages. a string table must be used). an important question is whether the high level language is case sensitive (is "a" the same as "A) For now, assume the language compiled IS case sensitive. - you may use any library or utility functions available (Java has a HashTable with findKey and put which are almost find and insert) - symbol table entries must be expandable. For this program, there is no information to store about each identifier name unless you choose to store a "block number" to distinguish between two different occurrences of the same name), the table must be able to handle multiple entries of the same name. This can be done by (I) having separate symbol tables for each scope (OPEN CLOSE) or (2) storing some means of differentiating between multiple copies of the same identifier, such as the "block number" of the declaration. FIND should be an efficient routine; it wll be called often. INSERT should be at least relatively efficient. Hash tables and balanced binary trees are the usual choices for a symbol table organization. FIND must return more than a simple Boolean: if found, it must return some means of retrieving the information in the symbol table (pointer to or copy of the record). FIND and INSERT must be separate routines; neither may be nested inside the other. Probably neither should call the other Test your program by creating a dummy file of identifier names with some method of indicating that a block starts or stops, One dummy file is below, but it isn't sufficient to test your program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started