Page 1 of 2

Languages implemented on Lisp?

Posted: Fri Sep 26, 2008 11:38 am
by tlareywi
Hi all,

I'm interested in looking at some examples of language implementation on Common Lisp. Even toy languages would be fine (perhaps preferable). Mainly, I'm curious about the different strategies and patterns people employ to do this. I would guess that there are tons of DSLs on Lisp but a preliminary Google search didn't turn up much. Anyone know of some good references on this topic?

Thanks,
Trystan

Re: Languages implemented on Lisp?

Posted: Fri Sep 26, 2008 12:55 pm
by PhazeDK
How about Python?

Re: Languages implemented on Lisp?

Posted: Fri Sep 26, 2008 2:37 pm
by Paul Donnelly

Re: Languages implemented on Lisp?

Posted: Fri Sep 26, 2008 3:02 pm
by tlareywi
Paul Donnelly wrote:There's Qi, and several Prologs.

http://www.lambdassociates.org/
http://norvig.com/paip/prolog.lisp
Wow, Qi looks really cool in particular. This should give me quite a bit to chew on. Thanks!

Re: Languages implemented on Lisp?

Posted: Mon Jan 05, 2009 9:12 pm
by mijokijo
I think you're lost.

Re: Languages implemented on Lisp?

Posted: Tue Jan 06, 2009 4:22 am
by dlweinreb
Peter Seibel gave a lecture at Google where he showed a simple example of a DSL in Lisp.

http://video.google.com/videoplay?docid ... 5356213813

Shriram Krishnamurthy of Brown has a slide presentation showing a finite-state machine done nicely as macros. (It's Scheme but it's all the same idea.) See slide 36 in

http://www.cs.brown.edu/~sk/Publication ... eforePerl/

Re: Languages implemented on Lisp?

Posted: Tue Jan 06, 2009 10:20 am
by findinglisp
dlweinreb wrote:Peter Seibel gave a lecture at Google where he showed a simple example of a DSL in Lisp.

http://video.google.com/videoplay?docid ... 5356213813

Shriram Krishnamurthy of Brown has a slide presentation showing a finite-state machine done nicely as macros. (It's Scheme but it's all the same idea.) See slide 36 in

http://www.cs.brown.edu/~sk/Publication ... eforePerl/
I did a similar state machine macro in CL after watching Shriram's talk:
http://www.findinglisp.com/blog/2004/06 ... macro.html

Re: Languages implemented on Lisp?

Posted: Fri Jan 09, 2009 10:08 am
by gcartier
tlareywi wrote:Hi all,

I'm interested in looking at some examples of language implementation on Common Lisp. Even toy languages would be fine (perhaps preferable). Mainly, I'm curious about the different strategies and patterns people employ to do this. I would guess that there are tons of DSLs on Lisp but a preliminary Google search didn't turn up much. Anyone know of some good references on this topic?

Thanks,
Trystan
JazzScheme http://www.jazzscheme.org/ is a Scheme derived language whose kernel was implemented fully in C. During the last 2 years, we made the crazy bet of converting the kernel to 100% pure Scheme code using macros.

After an initial drop in performance of being about 95x slower, performance is now 2x faster than the old C-based kernel. Macros enabled us to access the underlying Scheme functionality with no performance penalty. An important part of the performance is also due to the excellent Scheme implementation that we are using. Gambit http://dynamo.iro.umontreal.ca/~gambit/ ... /Main_Page, on top of being extremely fast, gives complete access to every low-level untyped facilities needed to implement something as performance demanding as a language.

And in term of code, the kernel implementation that was about 150K lines of C code is now done and a lot more in just 15K lines of much clearer and easy to evolve lines of Scheme code.

So yes languages implemented in Lisp sure are possible!

Guillaume Cartier

Re: Languages implemented on Lisp?

Posted: Fri Jan 09, 2009 10:23 am
by qbg
I believe I remember reading on comp.lang.lisp that an old version of Haskell ran on CMUCL.

Re: Languages implemented on Lisp?

Posted: Fri Jan 09, 2009 10:39 am
by feeley
As part of my research and courses, I have been implementing various languages in Scheme using the Gambit Scheme compiler. Three compilers implemented this way stand out:

1) ETOS, an Erlang to Scheme compiler which generates code that is roughly as fast as the HIPE native code compiler for Erlang. Here's a paper on it: http://www.iro.umontreal.ca/~feeley/papers/etos.ps . Also there is a (old) web page with the code: http://www.iro.umontreal.ca/~etos/ .

2) SIX, the "Scheme Infix syntaX" is a C-like syntax supported by the Gambit reader. Gambit comes with macros which implement a semantics very close to C. For example:

% gsi
Gambit v4.4.0

> \ for (int i=1; i<5; i++) pp(i*i);
1
4
9
16
> ' \ for (int i=1; i<5; i++) pp(i*i);
(six.for (six.define-variable (six.identifier i) int () (six.literal 1))
(six.x<y (six.identifier i) (six.literal 5))
(six.x++ (six.identifier i))
(six.call
(six.identifier pp)
(six.x*y (six.identifier i) (six.identifier i))))

3) A student of mine wrote a fairly complete Java compiler in Scheme which compiled Java to Scheme.

Marc Feeley