From: | Tony Finch <dot@dotat.at> |
Newsgroups: | comp.compilers |
Date: | 29 Jun 2011 18:55:26 +0100 (BST) |
Organization: | dotat labs |
References: | 11-06-037 11-06-042 |
Keywords: | storage, symbols |
Posted-Date: | 01 Jul 2011 09:44:03 EDT |
Originator: | fanf@chiark.greenend.org.uk ([212.13.197.229]) |
noitalmost <noitalmost@cox.net> wrote:
>
>I looked at Aho's description of displays. Currently, my interpreter
>is using a more abstract stack. It's a stack of pointers, so the first
>declared variable in a scope goes at frame offset 0, the second at
>offset 1, etc. I was thinking of dedicating offset 0 to be a pointer
>to all the bookkeeping info, such as enclosing scope pointers. Will
>this work as my language matures, or are there some glaring gotchas?
The paper on the implementation of Lua 5.0 describes how it deals with
references to variables in outer scopes.
http://www.lua.org/doc/jucs05.pdf
Lua keeps book-keeping information outside the main evaluation stack;
there's a parallel stack of procedure invocation records, and function
closures are stored on the heap.
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
Return to the
comp.compilers page.
Search the
comp.compilers archives again.