Wednesday, February 27, 2002

We nee dto look into symbol tables
METHOD 2 - SYMBOL TABLE OF LISTS/STACKS
Idea: Maintain a single symtab. Individual stacks, one for each name,
replace stack(list) of symbol tables. When parsing block b, stack
associated w/ each name x includes info about decl of x in b or in
scopes that enclose b. Level # attribute is used to determine whether
a decl was made in b's scope or in an enclosing scope.

(1) On block entry: increment level # (after entering proc name into symbol
table)
(2) See decl of x: look up x in symtab;
if x is there, fetch level # from the top of stack entry
if that level# = current level # then multi decl'd
else /* x is there, top of stack level # not equal current */
push (current level # and other attributes)
else /* x not in symbol table */
add x to symtab;
push (current level # and other attributes) onto x's stack
(3) See use of x: lookup x in symtab if not there or stack is empty then error.
(4) On scope exit:
(a) Scan entries in symtab popping every top-of-stack entry that has
current level #
(b) decrement level #

1 Comments:

At 8:20 AM, Blogger Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa

 

Post a Comment

<< Home