Lab 7
Symbol Tables II
Objectives
The objective of this laboratory is
- to provide a retrospective reivew of what has led to this point in which we begin extending our parser to create and manage symbol tables.
- to give you opportunity to work on your symbol tables with this information in hand.
To Do
Resolve Conflicts in Your LL(1) Table
Have a copy of your symbol table ready for review. We will examine it, particularly with respect to nonterminal OptionalElsePart and token "else";
Starting the Symbol Table
Refer to accompanying sample code below and this page of our hypertextbook as you do this part.
First, identify the corresponding points in your parser where calls to:
- create a new symbol table
- add items to a symbol table
- delete a symbol table
must be performed. Also decide what semantic information is needed and how you are going to maintain and pass that information around in your parser. Again, the referenced page in the hypertextbook (above) explains this in detail.
We will walk around the room and discuss this with you.
program lab1; var apple, candy: integer; y: float; zebra, xyz: integer; procedure mixit(a, b: integer; var x: float); var pony: integer; function fred(var q: float) returns integer; begin --fred -- Point 1
fred := q + 1; end; -- fred function mary(x: integer) returns integer; begin --mary -- Point 2 mary := x - 1; end; -- mary --Point 3
begin --mixit pony := a + b; end; --mixit begin --lab1 -- Point 4 write(zebra) end. --lab1
To Turn In
There will be nothing to turn in today.