Re: Implementing a stack-based interpreter

Tony Finch <dot@dotat.at>
26 Jul 2005 13:21:37 -0400

          From comp.compilers

Related articles
Implementing a stack-based interpreter cvrebert@gmail.com (2005-07-17)
Re: Implementing a stack-based interpreter ar.mcdonald@virgin.net (Alex McDonald) (2005-07-22)
Re: Implementing a stack-based interpreter mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2005-07-22)
Re: Implementing a stack-based interpreter gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-07-22)
Re: Implementing a stack-based interpreter john.carter@tait.co.nz (John Carter) (2005-07-22)
Re: Implementing a stack-based interpreter Jan.Bogaerts@telenet.be (Jan Bogaerts) (2005-07-22)
Re: Implementing a stack-based interpreter anton@mips.complang.tuwien.ac.at (2005-07-26)
Re: Implementing a stack-based interpreter dot@dotat.at (Tony Finch) (2005-07-26)
Re: Implementing a stack-based interpreter marcov@stack.nl (Marco van de Voort) (2005-08-03)
Re: Implementing a stack-based interpreter mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2005-08-05)
Re: Implementing a stack-based interpreter rossen.radev@gmail.com (aquarin) (2005-08-05)
Re: Implementing a stack-based interpreter tk@ic.unicamp.br (Tomasz Kowaltowski) (2005-08-07)
Re: Implementing a stack-based interpreter kszabo@bcml120x.ca.nortel.com (2005-08-07)
Re: Implementing a stack-based interpreter haberg@math.su.se (2005-08-10)
| List of all articles for this month |
From: Tony Finch <dot@dotat.at>
Newsgroups: comp.compilers
Date: 26 Jul 2005 13:21:37 -0400
Organization: dotat labs
References: 05-07-070 05-07-078
Keywords: interpreter, practice
Posted-Date: 26 Jul 2005 13:21:37 EDT

Alex McDonald <ar.mcdonald@virgin.net> wrote:
>
>One stack isn't quite enough, btw, unless you're interpreter is for a
>simple RPN calculator; Forth uses two, one for data and one for return
>addresses of called subroutines (called words in Forth).
>
>[One stack is enough if you have a simple enough procedure call without
>variable length argument lists and the like. -John]


In languages like Forth and Postscript where the operand stack is
explicit in the language, it is still usual for the call stack to
remain implicit. In languages like C and Pascal the details of the
stack are an implementation matter, but there's usually a single
combined stack. Functional programming implementations may be
no-stack (call frames on the heap), single-stack, or dual-stack. You
can convert a dual-stack implementation into a single-stack
implementation using continuation conversion, which makes the implicit
return address into an explicit operand. I don't know if any Forth
variants have been based on this idea.


Tony.
--
f.a.n.finch <dot@dotat.at> http://dotat.at/
BERWICK ON TWEED TO WHITBY: NORTH 3 OR 4 BECOMING VARIABLE 3. SCATTERED
SHOWERS. GOOD. SLIGHT.


Post a followup to this message

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