From: Ray Dillinger
Subject: Autotranslate existing libraries?
Date: 
Message-ID: <mWHre.756$p%3.6107@typhoon.sonic.net>
One thing that interests me is HLL->HLL translation.

It seems to me that few languages are as suitable as CL to being
the target language in such a translation, because whatever
semantics in a source language one is faced with, a few HLL's
and macros can give you a LISP form with similar semantics,
and translation is then fairly straightforward.

The resulting code wouldn't be a sterling example of LISP idioms,
obviously; but issues of linking and compiling code in other
languages can be neatly sidestepped (actually, I guess this is
a bigger issue for scheme, whose call semantics are drastically
less conforming to a linear stack model than Common Lisp's).

So instead of working on massive, massive libraries, one could
write a single, albeit complicated, perl->CL translator and point
it at CPAN, or just about any other open-source library.  (at
least in theory; I don't think my Lisp Chops are good enough
for this yet, but it's an interesting idea).

I think there are two main issues;  First, a lot of those
libraries make use of FFI's where, eg, perl calls C functions,
and translating perl to CL is an order of magnitude easier,
I think, than translating Perl + hairy perl-to-c FFI code +
C to CL.

Second, lots of libraries rely on low-level access to hardware.
That is, read and write access to memory-mapped hardware ports,
ability to lay out data structures in memory at the byte & word
level, and the power to issue and respond to hardware interrupts.

These run afoul of runtime constraints and abstraction barriers
in LISP.  Is there a portable way around these constraints and
barriers?

				Bear

From: William Bland
Subject: Re: Autotranslate existing libraries?
Date: 
Message-ID: <pan.2005.06.14.22.54.04.138864@abstractnonsense.com>
On Tue, 14 Jun 2005 21:24:34 +0000, Ray Dillinger wrote:
> 
> One thing that interests me is HLL->HLL translation.
> 
> It seems to me that few languages are as suitable as CL to being
> the target language in such a translation, because whatever
> semantics in a source language one is faced with, a few HLL's
> and macros can give you a LISP form with similar semantics,
> and translation is then fairly straightforward.
[snip]

A few weeks ago I wrote most of a Java->CL translator.  I abandoned it in
favour of "real work" before it was fully complete, but writing it did
very much drive home just how much of Java can be regarded as a subset of
CL.

The parser was easy (I used ANTLR), the translation was usually just a
matter of me recognising which CL language feature was half-implemented by
a given Java construct, and calling out to any compiled Java for which the
source wasn't available was easy because of Foil (presumably this would
extend to native/JNI libraries too, although I didn't test it).

Ultimately though it was just a learning exercise - I'm not sure what one
would ever use such a beast for ;-)

Cheers,
	Bill.
From: richhickey
Subject: Re: Autotranslate existing libraries?
Date: 
Message-ID: <1118796328.159169.26970@z14g2000cwz.googlegroups.com>
I'm currently working on Clojure
<https://sourceforge.net/projects/clojure/>, which will let you go in
the opposite direction: CL(subset) -> Java/C#. It (optionally) supports
the Foil syntax as well, and generates reflection-free calls to Java
and .Net libraries.
From: Edi Weitz
Subject: Re: Autotranslate existing libraries?
Date: 
Message-ID: <uekb4r14t.fsf@agharta.de>
On Tue, 14 Jun 2005 22:54:06 GMT, William Bland <·······@abstractnonsense.com> wrote:

> A few weeks ago I wrote most of a Java->CL translator.  I abandoned
> it in favour of "real work" before it was fully complete, but
> writing it did very much drive home just how much of Java can be
> regarded as a subset of CL.
>
> The parser was easy (I used ANTLR), the translation was usually just
> a matter of me recognising which CL language feature was
> half-implemented by a given Java construct, and calling out to any
> compiled Java for which the source wasn't available was easy because
> of Foil (presumably this would extend to native/JNI libraries too,
> although I didn't test it).
>
> Ultimately though it was just a learning exercise - I'm not sure
> what one would ever use such a beast for ;-)

You do know about the stuff Ant�nio Menezes Leit�o does, don't you?

  <http://www.evaluator.pt/linj.html>
  <http://weitz.de/eclm2005/>

(See the part about "Jnil" in his presentation.)

Cheers,
Edi.

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: William Bland
Subject: Re: Autotranslate existing libraries?
Date: 
Message-ID: <pan.2005.06.14.23.22.46.881933@abstractnonsense.com>
On Wed, 15 Jun 2005 01:04:34 +0200, Edi Weitz wrote:

> On Tue, 14 Jun 2005 22:54:06 GMT, William Bland <·······@abstractnonsense.com> wrote:
> 
>> A few weeks ago I wrote most of a Java->CL translator.  I abandoned
>> it in favour of "real work" before it was fully complete, but
>> writing it did very much drive home just how much of Java can be
>> regarded as a subset of CL.
[snip]
> 
> You do know about the stuff Ant�nio Menezes Leit�o does, don't you?
> 
>   <http://www.evaluator.pt/linj.html>
>   <http://weitz.de/eclm2005/>
> 
> (See the part about "Jnil" in his presentation.)
> 
> Cheers,
> Edi.

Yes I do, thanks - it's some very impressive work, and reading about it
was actually the reason I decided to do my own little translator as a
learning exercise!

Best wishes,
		Bill.