From: Thomas Heinzerling
Subject: Implementation of a small Lisp interpreter
Date: 
Message-ID: <379E5946.D9DECF64@heinzerling.com>
Hello,

my current job is to implement a small Lisp-like interpreter (in C++) to
easily extend the features of a graphical application.

Of course, It should be efficient and extendable.

Since this will be a commercial product, I cannot use public-domain
libraries.

Does anybody know about books which describe *HOW* to implement a Lisp
interpreter
(or compiler) ?

Since I am a beginner to Lisp the main problems for me are:
    1. macro expansion and backquoting: How are these features defined
(exactly) ?
        Is the order of expansion and evaluation of recursively defined
macros of importance ?
    2. lexical and dynamical binding: When to use the one or the other
and how to pass arguments ?
    3. *exact* description of all the Common Lisp features/functions ?

Thanx in advance
    Thomas

From: Tim Bradshaw
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <ey3wvvkka3u.fsf@lostwithiel.tfeb.org>
* Thomas Heinzerling wrote:

> Since this will be a commercial product, I cannot use public-domain
> libraries.

I think you should reconsider this.  *Some* `public domain' stuff is 
licensed in a way which makes it hard to use in a product.  Some is
not.  For instance the elk license (in part):

    Oliver Laumann, TELES GmbH, and Nixdorf Computer AG, as co-owners or
    individual owners of copyright in this software, grant to any person or
    company a worldwide, royalty free, license to

       i) copy this software,
      ii) prepare derivative works based on this software,
     iii) distribute copies of this software or derivative works,
      iv) perform this software, or
       v) display this software,

    provided that this notice is not removed and that neither Oliver Laumann
    nor Teles nor Nixdorf are deemed to have made any representations as to
    the suitability of this software for any purpose nor are held responsible
    for any defects of this software.

(elk is an embeddable scheme system with good C integration).  SIOD is
also I think freely usable (not sure about this).  There are others.

Some commercial systems may also be available suitable for embedding
in this way and may not be prohibitively expensive.

>     3. *exact* description of all the Common Lisp features/functions ?

If you're trying to implement the whole of CL you almost *certainly*
want to talk to a vendor and use theirs!  If you just want very good
descriptions, the Hyperspec is good --
http://www.harlequin.com/books/HyperSpec.

--tim
From: Friedrich Dominicus
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <379F3F5F.9843F2FB@inka.de>
Tim Bradshaw wrote:
> 
> * Thomas Heinzerling wrote:
> 
> > Since this will be a commercial product, I cannot use public-domain
> > libraries.

Python comes with a very liberal licence too. I sounds s.th like you can
whatever you wish to do but you are not allowed to claim that you have
invented the language. (check out www.python.org)

Regards
Friedrich
From: Paul Duffin
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <379EF28C.4138@mailserver.hursley.ibm.com>
Thomas Heinzerling wrote:
> 
> Hello,
> 
> my current job is to implement a small Lisp-like interpreter (in C++) to
> easily extend the features of a graphical application.
> 
> Of course, It should be efficient and extendable.
> 

It is not Lisp but this sort of job is exactly what Tcl was designed to
do. Embedding it is very simple, as is extending it.

> Since this will be a commercial product, I cannot use public-domain
> libraries.
> 

Tcl's licensing allows it to be used anywhere, in anyway by anyone.

-- 
Paul Duffin
DT/6000 Development	Email: ·······@hursley.ibm.com
IBM UK Laboratories Ltd., Hursley Park nr. Winchester
Internal: 7-246880	International: +44 1962-816880
From: Michael Spalinski
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <m3vhb52lgb.fsf@schwinger.harvard.edu>
>>>>> "Paul" == Paul Duffin <·······@mailserver.hursley.ibm.com> writes:

    Paul> Thomas Heinzerling wrote:
    >>  Hello,
    >> 
    >> my current job is to implement a small Lisp-like interpreter (in
    >> C++) to easily extend the features of a graphical application.
    >> 
    >> Of course, It should be efficient and extendable.
    >> 

    Paul> It is not Lisp but this sort of job is exactly what Tcl was
    Paul> designed to do. Embedding it is very simple, as is extending it.

    >> Since this will be a commercial product, I cannot use public-domain
    >> libraries.
    >> 

    Paul> Tcl's licensing allows it to be used anywhere, in anyway by
    Paul> anyone.

And the same is true for Lua (http://www.tecgraf.puc-rio.br/lua/) and
Python (http://www.python.org/). As far as lisp goes, I am not sure, but
Siod (a scheme implementation, see http://people.delphi.com/gjc/siod.html)
may also be free for commercial use. Lua and Siod are small and easy to
embed. Python is bigger, but has a huge set of useful libraries.

M. 
From: Lars Marius Garshol
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <wkbtcwzyf9.fsf@ifi.uio.no>
* Michael Spalinski
| 
| Lua and Siod are small and easy to embed. Python is bigger, but has
| a huge set of useful libraries.

It's also possible to trim its size quite a bit by not compiling in
all the built-in modules. Most of them have pure-Python
implementations as well.

--Lars M.
From: Fernando Mato Mira
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <379F0861.8059F95E@iname.com>
Thomas Heinzerling wrote:

> Hello,
>
> my current job is to implement a small Lisp-like interpreter (in C++) to
> easily extend the features of a graphical application.
>
> Of course, It should be efficient and extendable.
>
> Since this will be a commercial product, I cannot use public-domain
> libraries.

If you need native multithreading, nothing beats MzScheme. It's LGPL, so in
your case it should be OK [it's always nice to ask first].
From: Kent M Pitman
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <sfwvhb5o83k.fsf@world.std.com>
Thomas Heinzerling <········@heinzerling.com> writes:

> my current job is to implement a small Lisp-like interpreter (in C++) to
> easily extend the features of a graphical application.

Hmmm.
 
> Of course, It should be efficient and extendable.
> 
> Since this will be a commercial product, I cannot use public-domain
> libraries.

Some public domain stuff is possible to include without commercial
restriction.  Some commercial stuff is extremely reasonably priced.
You should definitely check out your options before starting from
scratch.  It's a fair amount of work ahead.  Don't be foolish.

For a rich source of references, try the interim home page of the
Association of Lisp Users (ALU) at:
  http://www.elwoodcorp.com/alu/

> Does anybody know about books which describe *HOW* to implement a Lisp
> interpreter (or compiler) ?

The Anatomy of Lisp is very old, but had some basic information.
I don't know that a lot of people write about this "in the whole".
Most people that do it either write a public domain system you should
read the source for or a proprietary system they don't want to talk about.
People can ask questions but not probably offer you a map.
 
> Since I am a beginner to Lisp the main problems for me are:
>     1. macro expansion and backquoting: How are these features defined
> (exactly) ?

See the spec.  [ref below]

>         Is the order of expansion and evaluation of recursively defined
> macros of importance ?

Macros expand into whatever they expand into.  If that happens to be another
macro, expansion is iteratively applied until it's not.  I don't know how
you could get this wrong, frankly.  I suppose there's a way.  But it's hard
to do, probably.

>     2. lexical and dynamical binding: When to use the one or the other
> and how to pass arguments ?

If you're implementing ANSI CL, then the answer is that you use lexical
binding except where dynamic binding is called for.  (The presence of
either a DECLARE expression in the body of the form or a global PROCLAIM
which mentions the variable being SPECIAL will cue you.)  See the spec
for details [ref below].

>     3. *exact* description of all the Common Lisp features/functions ?

You can browse this on the web at:

  http://www.harlequin.com/education/books/HyperSpec/FrontMatter/index.html

But if you use it a lot (and it sounds like you will), you should go to

  http://www.harlequin.com/education/books/HyperSpec/index.html

and read instructions for downloading your own copy privately.
You should also seriously consider getting one of the numerous commercial
implementations to use as a reference implementation, or even more than
one, to make sure they agree and that you aren't being faked out by a
vendor-specific interpretation.  The ALU web pages will point you to 
all the various implementations...

I hope you end up just using something that's out there instead of doing
this yourself.  I really think you'll be making a big mistake to do this
over.  It will probably take you years unless you subset the work, and if
you're a novice, you probably aren't qualified to do the subsetting.

Good luck.  
From: Friedrich Dominicus
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <379E943A.B09176C6@inka.de>
Thomas Heinzerling wrote:
> 
> Hello,
> 
> my current job is to implement a small Lisp-like interpreter (in C++) to
> easily extend the features of a graphical application.

Maybe I'm ignorant but why do you have to write one yourself and are not
using s.th which is there?

Regards
Friedrich
From: Chris Brew
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <Chris.Brew-2907991024140001@mac-chrisbr.cogsci.ed.ac.uk>
In article <·················@heinzerling.com>, ········@heinzerling.com wrote:

> Hello,
> 
> my current job is to implement a small Lisp-like interpreter (in C++) to
> easily extend the features of a graphical application.

You  shouldn't need to write your own interpreter. 
For example my colleagues at CSTR have made a speech synthesiser,
using SIOD as a scripting language. You could adopt SIOD for your
application too.


cf. <http://www.cstr.ed.ac.uk/projects/festival/>

I know they think carefully about the licensing issues, and that
one of their goals is to set things up so that commercial use is possible
The license is described in the manual as "an X11 type license",
which may mean (I'm no lawyer) that you can do pretty much
what you like with it. Earlier versions had limitations on
commercial use, I understand, but this one doesn't. You should
check this, but using SIOD seems reasonable to me. Of course,
it's Scheme, not Common Lisp.

C
From: Paolo Amoroso
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <37a46c18.9091774@news.mclink.it>
On Wed, 28 Jul 1999 03:13:42 +0200, Thomas Heinzerling
<········@heinzerling.com> wrote:

> my current job is to implement a small Lisp-like interpreter (in C++) to
> easily extend the features of a graphical application.
> 
> Of course, It should be efficient and extendable.
[...]
>     3. *exact* description of all the Common Lisp features/functions ?

If #3 implies that your extension language should look like Common Lisp, it
may be easier to rewrite the graphical application in Common Lisp: you
would get an extension language--and potentially many more languages--for
free :)


Paolo
-- 
Paolo Amoroso <·······@mclink.it>
From: Reini Urban
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <37a0e729.51500804@judy.x-ray.local>
Thomas Heinzerling <········@heinzerling.com> wrote:
>Since this will be a commercial product, I cannot use public-domain
>libraries.

?? 
of course you may use "public domain" code, but most likely no FSF nor
GPL nor Open Source code, if you don't want to release sources to your
clients.

>Does anybody know about books which describe *HOW* to implement a Lisp
>interpreter (or compiler) ?

see the ALU site. almost every better lisp book does this: 
SICP, Norvig, Winston/Horn, Queinnec (hairy), 

available sources are besides SIOD also other super-tiny lisps, 
like 
Queinnec's (he has 7 in his book)
SLISP http://redbull.dcs.fmph.uniba.sk/~vasko/slisp (in C++) 
ABUSE http://www.jitit.com/abuse/ 
  a doom-like game by crack dot com is now PD and has a small lisp 
  in 4 C files. read the story about abuse and crack dot com at 
  http://www.loonygames.com/content/1.10/guest/

i would start with abuse or SLISP.

--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html
From: Reini Urban
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <37a0ee50.53331797@judy.x-ray.local>
while lurking around at crack-dot-com i saw that their latest doom-like
game "golgotha" also made it to open source and that their lisp engine
from abuse was ported to C++ and somewhat improved.

those guys (jonathan clark) has a nice attitude to get their games paid
"somehow" with keeping the rights and release it then to the community
for recreation and develop better games :)

http://www.golgotha.org/source/docs/lisp.cc.html
download the small src tree at:
http://www.golgotha.org/source/downloads/gfsrc.zip [3MB]
--                                         
Reini
From: Rainer Joswig
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <joswig-3007990253020001@194.163.195.67>
In article <·················@judy.x-ray.local>, ······@sbox.tu-graz.ac.at wrote:

> while lurking around at crack-dot-com i saw that their latest doom-like
> game "golgotha" also made it to open source and that their lisp engine
> from abuse was ported to C++ and somewhat improved.
> 
> those guys (jonathan clark) has a nice attitude to get their games paid
> "somehow" with keeping the rights and release it then to the community
> for recreation and develop better games :)
> 
> http://www.golgotha.org/source/docs/lisp.cc.html
> download the small src tree at:
> http://www.golgotha.org/source/downloads/gfsrc.zip [3MB]
> --                                         
> Reini

Btw., a few months ago I went to mozilla.org and downloaded the
web browser source, it included a version of
a Javascript specification written in Macintosh Common Lisp.
Funny...
From: Rainer Joswig
Subject: Re: Implementation of a small Lisp interpreter
Date: 
Message-ID: <joswig-3007990259460001@194.163.195.67>
In article <·······················@194.163.195.67>, ······@lavielle.com (Rainer Joswig) wrote:

> In article <·················@judy.x-ray.local>, ······@sbox.tu-graz.ac.at wrote:
> 
> > while lurking around at crack-dot-com i saw that their latest doom-like
> > game "golgotha" also made it to open source and that their lisp engine
> > from abuse was ported to C++ and somewhat improved.
> > 
> > those guys (jonathan clark) has a nice attitude to get their games paid
> > "somehow" with keeping the rights and release it then to the community
> > for recreation and develop better games :)
> > 
> > http://www.golgotha.org/source/docs/lisp.cc.html
> > download the small src tree at:
> > http://www.golgotha.org/source/downloads/gfsrc.zip [3MB]
> > --                                         
> > Reini
> 
> Btw., a few months ago I went to mozilla.org and downloaded the
> web browser source, it included a version of
> a Javascript specification written in Macintosh Common Lisp.
> Funny...

see

http://lxr.mozilla.org/mozilla/source/js/semantics

for the Lisp code.