Re: Functional Symbol Tables (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Fri, 13 Jul 2007 09:30:25 +0200

          From comp.compilers

Related articles
Functional Symbol Tables (bison) (2007-07-09)
Re: Functional Symbol Tables (2007-07-13)
Re: Functional Symbol Tables (A.T.Hofkamp) (2007-07-13)
Re: Functional Symbol Tables (2007-07-18)
| List of all articles for this month |

From: (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Newsgroups: comp.compilers
Date: Fri, 13 Jul 2007 09:30:25 +0200
Organization: Department of Computer Science, University of Copenhagen
References: 07-07-039
Keywords: functional, symbols
Posted-Date: 15 Jul 2007 16:24:45 EDT

bison <> writes:

> I'm trying to figure out a way to implement symbol tables in a
> functional style, but I can't figure out a way to do that. The only
> way I can think to do it is to keep track of names during parsing for
> each scope and upon entering a scope add these bindings to the
> existing table.
> I read somewhere that you can pass around your ST through arguments.
> My thought about that is that if you are using recursion, you will
> lose all of your mappings once that call is returns. Does anyone have
> any thoughts on this?

The bindings you lose on return are exactly those that go out of
scope, so this is desired behavior.

You can download my book "Basics of Compiler Design" from
[]. Chapter 4 is about
symbol tables, discussing imperative versus persistent (functional)
tables, and you can see examples of use of functional symbol tables in
chapters 5 and 6.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.