Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Seeking tools for generating C++ code from Lisp

324 views
Skip to first unread message

John Morrison

unread,
Oct 31, 2000, 3:05:50 PM10/31/00
to j...@mak.com
Hi All;

The Short Version of the Problem: I want to write code in Lisp, and I
wish to compile it to C++, which must in turn be compiled against
several large, pre-existing C++ libraries. I am seeking tools which
would aid me.

The Longer (but as concise as possible) Version: I wish to write
"behaviors" for real-time, networked, virtual environment objects (e.g.,
people, combat vehicles, etc.) in a derivative of Rodney Brooks' (et al)
Behavior Language. As near as I can tell as of this writing, the
Lisp-based reference implementation compiles to an intermediate Lisp
form, and thence to either MC68K asm or CL for a simulation. I wish to
retarget the "back end" of this compiler to emit code which is
compilable against (and use many services of) a set of reasonably
extensive (several hundreds of thousands of lines of our own, and
several millions of lines of other people's) C++ libraries. I wish to
do this in the most economically rational fashion possible (i.e., any
suggestion that include rewriting those C++ libraries is DOA).

I know CLISP can take me from CL to C. I know I can define foreign
functions in CLISP. I presume my biggest problem (hey, let's keep this
technical ;=) is to generate these numerous bindings from the existing
C++ code in an as-automated-as-possible fashion. I am guessing that I
am not the only guy reading this list who would like to use C/C++
functions from Lisp -- somebody must've solved this problem by now. Can
anybody recommend a good, efficient (in terms of my labor) technique
and/or tool? A bastardized C++ compiler? A Lisp-based parser for C++?
Some abomination hacked together out of GNU objutils? Some fabulously
expensive COTS product?

I am open to any and all suggestions.

Oh yeah, anybody interested in an applied AI job in the Cambridge, MA
area? Some knowledge about human modeling and simulation is required --
knowledge about particular real-time techniques like BL and Bayesian
Belief Networks (etc.) would be fabulous.

Thanks for any help!

-jm

--
==== John Morrison
==== MaK Technologies Inc.
==== 185 Alewife Brook Parkway, Cambridge, MA 02138
==== http://www.mak.com/
==== vox:617-876-8085 x115
==== fax:617-876-9208
==== j...@mak.com

Erik Naggum

unread,
Oct 31, 2000, 3:03:27 PM10/31/00
to
* John Morrison

| The Short Version of the Problem: I want to write code in Lisp, and
| I wish to compile it to C++, which must in turn be compiled against
| several large, pre-existing C++ libraries. I am seeking tools which
| would aid me.

Gee, that is just what I did with a bunch of legacy code some time
ago (I posted about tools that accepted C/C++ input and produced FFI
declarations, arguing that a "standard" FFI is bogus, that tools to
automate the task for each FFI is the key), but when I went to find
it, I found an "interesting" match for you, instead, so I dropped it
cold. I hope others aren't going to help you, either, because they
probably will get the same kind of "thanks" I got when I tried to
help you last time.

You probably had yourself a good time then, so I hope you have a
good time, now, too. Are you still heading the fastest-growing
company in Cambridge, MA, turning such massive profits you have to
deride and ridicule those who help others on the Net just to feel
good about it? Whatever do you need _free_ help from others for
that you cannot go out there and just _buy_ with all that money you
claim you make? Get ethical and pay for it, if that _disgusting_
bragging has any reality behind it at all, will you?

Man! If it weren't for the excellent news search engines, I would
have walked right into this one, possibly giving you free advice or
worse: free code, that turned into _billions_ of dollars for you
that you could brag and boast some more about to elevate yourself
above the people who help you. What a waste that would have been.

It will probably take a very competent programmer with experience in
producing readers and writers for "alternate" syntaxes from their
grammars and a _desire_ to represent C++'s arcana in Common Lisp
some six months to design and write the tools you need. But then
you can sell it for tons of money and your fastest-growing bueiness
can grow fastester! Wouldn't that be something! Now you surely see
the ethical aspects of asking others to do this for free for someone
like you, even if you didn't when you posted this request, right?
Because giving people valuable stuff for free isn't how _you_ got
into the position you could brag so much about, is it?

#:Erik
--
Does anyone remember where I parked Air Force One?
-- George W. Bush

John Morrison

unread,
Oct 31, 2000, 8:02:21 PM10/31/00
to j...@mak.com
Hello;

Erik Naggum wrote:
>
> * John Morrison
> | The Short Version of the Problem: I want to write code in Lisp, and
> | I wish to compile it to C++, which must in turn be compiled against
> | several large, pre-existing C++ libraries. I am seeking tools which
> | would aid me.
>
> Gee, that is just what I did with a bunch of legacy code some time
> ago (I posted about tools that accepted C/C++ input and produced FFI
> declarations, arguing that a "standard" FFI is bogus, that tools to
> automate the task for each FFI is the key), but when I went to find
> it, I found an "interesting" match for you, instead, so I dropped it
> cold. I hope others aren't going to help you, either, because they
> probably will get the same kind of "thanks" I got when I tried to
> help you last time.

Alack and alas, now I am certain that I shall remain shivering and cold,
alone in my distress, unaided and unheeded by the readership of this
newsgroup. Oh, woe is me! The futility, to be so derided, publicly
humiliated, nay, *blackballed* by the estimable Erik, scourge of
comp.lang.lisp! However shall I endure the endless invective heaped
upon me? The pain! The pain!

> You probably had yourself a good time then, so I hope you have a
> good time, now, too. Are you still heading the fastest-growing
> company in Cambridge, MA, turning such massive profits you have to
> deride and ridicule those who help others on the Net just to feel

Well, actually, I seem to recall deriding and ridiculing only one
person, and I do not recall being profitable as motivating me to do so.
Everybody else seemed really helpful. I fondly recall the experience,
and found it most enlightening. I even found my interaction with you to
be enlightening, although perhaps not in the way you intended.

> good about it? Whatever do you need _free_ help from others for
> that you cannot go out there and just _buy_ with all that money you
> claim you make? Get ethical and pay for it, if that _disgusting_
> bragging has any reality behind it at all, will you?

If you might recall, at the end of my last message, I offered a paying
job to a qualified candidate. But maybe you were blinded by your
apoplectic rage, and missed the paragraph. I suggest lying down on the
floor and breathing into a paper bag. Then, try reading the message
again. The mention of the job is right down near the bottom.

> Man! If it weren't for the excellent news search engines, I would
> have walked right into this one, possibly giving you free advice or
> worse: free code, that turned into _billions_ of dollars for you
> that you could brag and boast some more about to elevate yourself
> above the people who help you. What a waste that would have been.

Geez, I *knew* we shouldn't have given stock options! We should have
*kept* them to ourselves! How silly of us. Thanks, Erik, I'll issue a
memo straightaway!

> It will probably take a very competent programmer with experience in
> producing readers and writers for "alternate" syntaxes from their
> grammars and a _desire_ to represent C++'s arcana in Common Lisp
> some six months to design and write the tools you need. But then
> you can sell it for tons of money and your fastest-growing bueiness
> can grow fastester! Wouldn't that be something! Now you surely see

Congratulations, you have (more or less) derived capitalism. This is
exactly what I'm asking for advice for, and what I'm offering a job for
(although the margin would be better if it took less than six months).

The Lisp relevance (why I posted to c.l.l instead of monster.com) is
that then the "interesting" bits (the compiler is not an "interesting"
bit) would be done in Lisp, so that I and anybody who helped here would
be creating more cash-positive Lisp jobs in the marketplace (might not
be many right off the bat, but one has to start somewhere).

Furthermore, assuming we (collectively) were successful, then there
would exist the opportunity for anybody (who signs the standard VAR/OEM
agreement) to VAR/OEM our underlying software and sell Lisp-based
modules atop it, furthering the growth of Lisp jobs, with profits
accruing to both of us. We currently do this for our C++-based
VARs/OEMs, and I should like to create some Lisp-based ones.

I seem to recall in one of the endless, recurring "why isn't Lisp more
popular" debates somebody (geez, I'm sorry but I forgot your name
whoever you are) saying that Lisp would be more popular if it
solved/addressed a problem that was not (as) tractable with other
languages/tools. I think the problem I'm working (simulating
individuals and groups in real-time) has some of those aspects. People
have tried in FORTRAN, Ada, C, C++, and Lisp, too, all with limited
success (although I think the Lisp attempts got a lot further before
they went Tango Uniform). Maybe this is a good "driving problem."

> the ethical aspects of asking others to do this for free for someone
> like you, even if you didn't when you posted this request, right?
> Because giving people valuable stuff for free isn't how _you_ got
> into the position you could brag so much about, is it?

If I *don't* pay you for valuable stuff, then will you please stop
giving it?

Erik Naggum

unread,
Oct 31, 2000, 8:30:12 PM10/31/00
to
* John Morrison <j...@mak.com>

| Alack and alas, now I am certain that I shall remain shivering and
| cold, alone in my distress, unaided and unheeded by the readership
| of this newsgroup. <Rest of rant elided.>

Thank you for continuing with your satire when it is clear that you
have been hurt and simply want to retaliate. I was nervous for a
second that you might engage your brain and do something wild and
unexpected that would put my conclusions about you to shame, but I
quickly realized I should trust you to prove them by _outdoing_ your
past self. Does it really feel good to be you with all that money
and success, but _zero_ conscience? I'm happy I shall never really
have to find out.

Good luck getting "help", Braggadochio. All your colleagues are
proud of you today as you excelled more than usual in showing off.

Here's a free hint because you'll never be able to use it: If you
really want to respond intelligently to someone who has hurt you,
apologize for what you did wrong to them. From someone like you,
it doesn't even have to be honest to have a positive spin effect.

Whatever I once did to you to cause your mind to snap so bad, I can
assure you it was not with any purpose of exposing your personality,
but this time it was, and you complied _excellently_. Thank you.

I hope you have some friends left who can tell you what you should
not do now, but this _might_ become quite entertaining. Your move.

Lieven Marchand

unread,
Oct 31, 2000, 4:09:00 PM10/31/00
to
John Morrison <j...@mak.com> writes:

> The Short Version of the Problem: I want to write code in Lisp, and I
> wish to compile it to C++, which must in turn be compiled against
> several large, pre-existing C++ libraries. I am seeking tools which
> would aid me.

On the Franz ftp site you can find cbind, which is a modification of
gcc to emit Allegro CL FFI. Further there's SWIG, but the closest it
comes to CL is a MzScheme back end. Then there's FFIGEN, which uses a
Scheme representation as intermediate language but also doesn't have a
CL back end.

--
Lieven Marchand <m...@bewoner.dma.be>
Lambda calculus - Call us a mad club

Paolo Amoroso

unread,
Nov 1, 2000, 9:34:04 AM11/1/00
to
On Tue, 31 Oct 2000 15:05:50 -0500, John Morrison <j...@mak.com> wrote:

> The Short Version of the Problem: I want to write code in Lisp, and I
> wish to compile it to C++, which must in turn be compiled against
> several large, pre-existing C++ libraries. I am seeking tools which
> would aid me.

You may have a look at STELLA (Strongly TypEd Lisp-like LAnguage), which is
illustrated in the paper:


"STELLA - A Lisp-like Language for Symbolic Programming with Delivery in
Common Lisp, C++, and Java"
Hans Chalupsky, Robert M. MacGregor
Proceedings of Lisp User Group Meeting 99 (LUGM '99)
Possible online version of the paper: exercise for the reader

Abstract
We describe STELLA, a strongly typed, object-oriented, Lisp-like language,
designed to facilitate symbolic programming tasks in artificial
intelligence applications. STELLA preserves those features of Common Lisp
deemed essential for symbolic programming such as built-in support for
dynamic data structures, heterogeneous collections, first-class symbols,
powerful iteration constructs, name spaces, an object-oriented type system
with meta-object protocol, exception handling, and language extensibility
through macros, but without compromising execution speed, interoperability
with non-STELLA programs, and platform independence. STELLA programs are
translated into a target language such as C++, Common Lisp, or Java, and
then compiled with the native target language compiler to generate
executable code. The language constructs of STELLA are restricted to those
that can be translated directly into native constructs of the intended
target languages, thus enabling the generation of highly efficient as well
as readable code.


Folks, am I the only one who reads Lisp conference proceedings? :-)


Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/

Thom Goodsell

unread,
Nov 2, 2000, 11:16:32 AM11/2/00
to
Paolo Amoroso <amo...@mclink.it> writes:

> On Tue, 31 Oct 2000 15:05:50 -0500, John Morrison <j...@mak.com> wrote:
>
> > The Short Version of the Problem: I want to write code in Lisp, and I
> > wish to compile it to C++, which must in turn be compiled against
> > several large, pre-existing C++ libraries. I am seeking tools which
> > would aid me.
>
> You may have a look at STELLA (Strongly TypEd Lisp-like LAnguage), which is
> illustrated in the paper:
>
>
> "STELLA - A Lisp-like Language for Symbolic Programming with Delivery in
> Common Lisp, C++, and Java"
> Hans Chalupsky, Robert M. MacGregor
> Proceedings of Lisp User Group Meeting 99 (LUGM '99)
> Possible online version of the paper: exercise for the reader

http://www.isi.edu/isd/LOOM/Stella/


--
Thom Goodsell t...@cra.com
Scientist (617) 491-3474 x574
Charles River Analytics http://www.cra.com/

0 new messages