Related articles |
---|
Fwd: Re: How to design a symbol table? J.vanKatwijk@ewi.tudelft.nl (jan) (2004-10-21) |
From: | jan <J.vanKatwijk@ewi.tudelft.nl> |
Newsgroups: | comp.compilers |
Date: | 21 Oct 2004 22:28:55 -0400 |
Organization: | Compilers Central |
Keywords: | symbols |
Posted-Date: | 21 Oct 2004 22:28:55 EDT |
I built both an Ada compiler (long time ago) and an Algol 60 compiler
using this. Basically, the table you need is a lookup table that does
not need to live after declaration processing and identifier
lookup. Obviously, you pay a price, i.e. interpretation of declaration
info. But then, it is fairly easy to add attributes to your AST nodes,
just use some profiling tool to see what data best can be cached into
the AST nodes. Ada type information can be fairly complex as well, so
it is just a matter of finding a balance between data stored in nodes
and data reachable through pointers.
regards
janvk
---------- Forwarded Message ----------
Subject: Re: How to design a symbol table?
Date: Sunday 17 October 2004 10:10 pm
From: "Rodney M. Bates" <rbates@southwind.net>
Having always done it and seen it done this way for years, I have
recently become intrigued with the opposite approach: All the symbol
table contains is a pointer to the AST subtree for the declaration.
Furthermore, when a lookup is done, a copy of theisST declaration
pointer becomes a semantic attribute of the AST node for the
reference. Then the symbol table goes away. ...
Return to the
comp.compilers page.
Search the
comp.compilers archives again.