Re: Interpreter design

"Steven D. Majewski" <>
1 Feb 2001 17:43:08 -0500

          From comp.compilers

Related articles
[6 earlier articles]
Re: Interpreter design (Venkatesha Murthy) (2001-01-19)
Re: Interpreter design (Juan Carlos Gil Montoro) (2001-01-19)
Re: Interpreter design (Laurent Guerby) (2001-01-19)
Re: Interpreter design (2001-01-19)
Re: Interpreter design (2001-01-20)
Re: Interpreter design (2001-01-26)
Re: Interpreter design (Steven D. Majewski) (2001-02-01)
| List of all articles for this month |

From: "Steven D. Majewski" <>
Newsgroups: comp.compilers
Date: 1 Feb 2001 17:43:08 -0500
Organization: University of Virginia
References: 01-01-059 01-01-075 01-01-113
Keywords: interpreter, design
Posted-Date: 01 Feb 2001 17:43:08 EST

Juan Carlos Gil Montoro <> wrote:
>Basile STARYNKEVITCH wrote:
>> If you do want to make a new langage, first study lots of existing
>> languages and existing implementations....
>> In short, the best strategy to implement an interpreter is to not do
>> it.
>> Perhaps you could use or extend an existing implementation... Why not
>> use Ocaml, Scheme, Tcl, Python, Perl, Ruby, etc....?
> Thanks for the advice but I do need to create a special-purpose language.
>> Do you need to embed an interpreter inside an application (or do the
>> reverse: embed your application inside an interpreter).
> My aplication must run programs in that language, pause them, abort
> them, you get the idea.
>> Perhaps you could translate your language to an existing bytecode
>> interpeter (such as Ocaml's, or JVM, or VSCM, ....).
> But then I would not have the fine control over running programs that
> I need, in particular I must be able to pause and resume running programs.

Note that he said use *OR EXTEND* and existing implementation. Most
Java VM's aren't open source, but for most of the others, there's no
reason you can't insert your own hooks into the interpreter loop. (
Some of them already have hooks in there for debugging and
benchmarking or checking for GUI events. )

Some of those implementations come with interactive debuggers that
already do most of what you want.

If you need to do some more fancy saving of state and continuing,
you might look at what you can do with Scheme continuations.
( The "stackless" version of Python also has some experimental
    support for continuations. )

If, after looking at existing implementations, you still think you
need to do your own language from scratch, at least consider that if
you can't reuse code, you can still reuse design. And if you can't
reuse design, you can still reuse syntax!

If you're going to inflict yet another language on the world, you
ought to at least start with a detailed critique of why exactly
languages X,Y & Z fall short of what you need, what they do right
and what they do wrong (from your POV).

It also helps to explain your language if you can say it's Lisp-Like
or Smalltalk-like (or whatever) except for these changes...

-- Steve Majewski <sdm7g@Virginia.EDU>

Post a followup to this message

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