Related articles |
---|
Common ADT for a identifier table ? stefan.wils@zorro.ruca.ua.ac.be (1999-02-05) |
Re: Common ADT for a identifier table ? bfahle@forelogic.com (Bill Fahle) (1999-02-15) |
From: | "Bill Fahle" <bfahle@forelogic.com> |
Newsgroups: | comp.compilers |
Date: | 15 Feb 1999 23:36:49 -0500 |
Organization: | OnRamp, http://www.onramp.net/ |
References: | 99-02-028 |
Keywords: | design, symbols |
Stefan Wils wrote in message 99-02-028...
>What kind of Abstract Data Type would you suggest for an identifier
>table, that has to hold all identifier names and their types (not
>content).
Hi, I usually write in C++, so I usually end up using one of the
Standard Template Library collection classes, like multimap. This is
usually implemented as a red-black or AVL tree, but the standard
interface doesn't specify implementation details. Of course, scoping
is a whole other matter. If that is a concern, I build a custom
symbol tree via child-sibling (and often parent) pointers, and then I
make each multimap the value of the declarator associated with it (for
example, in parsing C++, each class defines a multimap symbol table,
and so does each block, although you can't necessarily get to the
blocks by scope operator ::).
Return to the
comp.compilers page.
Search the
comp.compilers archives again.