Related articles |
---|
Functional Symbol Tables sgillespie@bisonofborg.com (bison) (2007-07-09) |
Re: Functional Symbol Tables torbenm@app-4.diku.dk (2007-07-13) |
Re: Functional Symbol Tables a.t.hofkamp@tue.nl (A.T.Hofkamp) (2007-07-13) |
Re: Functional Symbol Tables kennheinrich@sympatico.ca (2007-07-18) |
From: | torbenm@app-4.diku.dk (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 <sgillespie@bisonofborg.com> 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
[http://www.diku.dk/~torbenm/Basics/index.html]. 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.
Torben
Return to the
comp.compilers page.
Search the
comp.compilers archives again.