> I know this is comp.compilers, but since there isn't a> comp.interpreters, I figure this is the right place to ask.> I'm trying write an interpreter for a programming language but haven't> been able to find anything on how to write a stack-based interpreter.> If anyone could point me to a book/website I'd be much obliged.

> [Compile to a string of reverse polish operators, then interpret that string> pushing results on the stack and popping operands off the stack. -John]

Yes.

Many of the needed techniques are the same, so many compiler books
should also be useful to interpreter writers.

Most interpreters do at least a little bit of compiling.

The usual BASIC interpreter compiled each line, mostly by converting
keywords to a single byte, and sometimes converting numeric constants
to internal form. That is done to each line as it is typed in.

Also, it is very unusual for compilers to compile everything down to
machine code. Most use subroutine calls for I/O and more complicated
mathematical operations. On machines without hardware multiply and
divide, those are done by subroutine call.