Saturday, June 17, 2006

Silly idea?

I wonder if it's worth considering setting up something that'll generate C++ code from sexps? Similar to the various HTML or HLSL/CG generators. Might be interesting to think about...

7 Comments:

Blogger Marcin said...

How would this be different from a translator/compiler like Bigloo? Most especially in terms of functionality provided, as I doubt that many people will care that it can't done interactively from a bigger (Common) Lisp programme.

1:11 am  
Blogger Jon Philpott said...

How do you see it working? are you talking about doing (forgive java syntax, i don't know C++):

(gen-java '(public class Foo (:extends Bar)
   (public String hello (String args)
      ...)))
=>
"public class Foo extends Bar {
  public String hello(String args) {
...
"

Could be useful for eliminating boiler-plate code!

7:44 am  
Blogger Damyan said...

The gen-java example is pretty much what I was thinking of. I guess I'm thinking more of a preprocessor than something that generates C(++) code from lisp code.

One possible use could be that if you're alternating hard/soft layers you could have all the code in your lisp files.

However, I'm starting to think that it isn't all that great an idea - just something born out of having to do dodgy hacks with the c preprocessor and wishing I had lisp.

9:13 am  
Blogger Brian T. Rice said...

See also Symbolic C Expressions to generate C code and LINJ which macro-generates/infers java code.

2:07 am  
Blogger Damyan said...

Thanks Brian! The scexp site seems to be down at the moment, but Linj is pretty much exactly what I was thinking of.

9:32 am  
Blogger fukanchik said...

InteLib - is a library of C++ classes which lets you do Lisp programming within your C++ program even without any additional preprocessing, without all those calling conventions etc.

3:54 am  
Blogger fukanchik said...

InteLib - is a library of C++ classes which lets you do Lisp programming within your C++ program even without any additional preprocessing, without all those calling conventions etc.

3:55 am  

Post a Comment

<< Home