Implementation of a small Lisp interpreter 
Author Message
 Implementation of a small Lisp interpreter

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



Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:

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

Hmmm.

Quote:
> 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/

Quote:
> 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.

Quote:
> 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]

Quote:
>         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.

Quote:
>     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].

Quote:
>     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....

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.  



Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:

> 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



Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:

> 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.

Quote:
> 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

IBM UK Laboratories Ltd., Hursley Park nr. Winchester
Internal: 7-246880      International: +44 1962-816880



Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter


    >>  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.



Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:

> 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].


Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

* 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.



Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:

> 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.

Quote:
>     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



Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:


> > 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



Sun, 13 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:

> 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



Mon, 14 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter
On Wed, 28 Jul 1999 03:13:42 +0200, Thomas Heinzerling

Quote:

> 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
--



Mon, 14 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:

>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.

Quote:
>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



Tue, 15 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter
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



Tue, 15 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:

> 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...


Tue, 15 Jan 2002 03:00:00 GMT  
 Implementation of a small Lisp interpreter

Quote:


> > 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.



Tue, 15 Jan 2002 03:00:00 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. Small embeddable Lisp or Scheme interpreter?

2. small, free Lisp/Scheme interpreter for PC?

3. Small embeddable Lisp or Scheme interpreter?

4. small, free Lisp/Scheme interpreter for PC?

5. A very small lisp interpreter

6. Small LISP Interpreters in HLL ?

7. Writing a small logo interpreter

8. Small Interpreters Catalog

9. Small interpreters Benchmark: Fibo Festival

10. small scheme interpreter pointers wanted

11. Scm an interpreter for small scheme programs !???

12. I want a *really* small Ruby interpreter

 

 
Powered by phpBB® Forum Software