Amplifying C
voodoo-slide.blogspot.com
voodoo-slide.blogspot.com
Interested parties can also hack on Parenscript: it compiles a decent chunk of Lisp to JavaScript, it's extremely well documented, and even has a CLOS like object system.
http://common-lisp.net/project/parenscript/
Regards.
- someone who compiles lisp to native object code
To implement PowerLoom we developed a new programming language called STELLA, which is a Strongly Typed, Lisp-like LAnguage that can be translated into Lisp, C++ and Java. PowerLoom is written in STELLA and therefore available in Common-Lisp, C++ and Java versions.
i think this is a grave 'leaky abstraction' waiting to happen, though. when his 'amplify' system screws up, it's going to do so in a way that nobody else can understand.
Have you tried Forth? It is great at low-level stuff.
But you said low-level. iPhone apps are high-level.
(not trying to be snarky. if you have written your own forth interpreter, then you are a lot more hardcore than me.)
If you're looking for a practical "low level but high level" setup, I'd recommend Lua + C first. I haven't done iphone dev, but if you can work with C, you're golden. Forth is fun, though.
brace was on HN a few months ago: http://sam.nipl.net/brace
"Brace has coroutines, hygenic macros, header generation, #! scripting and cached executables, libraries with graphics and sound, and many animated demos." (http://sam.nipl.net/brace/)
If anything I'd expect this to be easier to deal with than multiple layers of plain C macros given it's going to be a lot easier to introspect - at least for the same level of complexity of expanded result.
Of course, if you do substantially more complex things with it then, yes, it's going to be more complex to debug. But that's always the price paid for using complex abstractions - complexity can be corralled, compartmentalised and contained but rarely eliminated entirely.
Take it as use "Lisp" Alphabet, but still write a "C" language. Not good analogy, but gets you there.
What he would achieve - well the same semantics, anything generated by his amplifier would be linkable, runnable the same way as C.
What he would achieve by using Lisp - we'll he can just skip the whole C++ templa-bastardization, and just use common lisp macros. He can use it for anything that he would like... Hell I would like to use it tommorow.
It won't be easy on the guy that's trying to debug that thing, after such transformations you would need some heavy "#line" preprocessor magic put in the "C" code, but it's doable.
TCL was also designed with this style of programming in mind, and John Ousterhout describes it pretty well (http://www.vanderburg.org/OldPages/Tcl/war/0009.html).
FWIW, LuaJIT is only available for i386 at the moment, though amd64 porting is in progress. Standard Lua is still pretty fast, and it's great for prototyping. It's a good idea to get algorithms and overall design right before spending much time on low-level tuning.
The biggest problem with these things is not parsing source code and output something else; you get the real pain when you're going to debug. :)
Since Parenscript is one of "these things", I have to disagree. We've been careful to make PS generate readable, debuggable JS code. It's not what you'd write by hand, of course, but it is not a problem to debug. I debug it every day using standard JS tools. (The biggest problem with PS is the impedance mismatch between Javascript's semantics and Lisp's, but that's another story.)
As I'm sure you're aware, sophisticated C++ template code can be nightmarish to debug. Easier debugging is actually one of the goals of the OP, so if what you said were true then his whole project would be a why-bother.
Granted I hate C++ with vengeance my poison if choice is C99 + LUA which creates a really powerful lowlevel and high level combo. Using lua to drive it, farming bits out to C, instead of the opposite "scripting language addon" approach. Yeah lua isnt quite as powerfull as lisp but gets pretty close and dosent look like alien space talk to new devs.
Guess it depends on whats the advantage of doing this is? just for fun? or for a serious practical application.
I would say most reasons for creating new languages -- for fun, for production usage, as a learning experience -- are good.
While I too prefer C+Lua, Schemes that compiler to C are another option. Chicken Scheme (http://www.call-with-current-continuation.org/) is quite good. Gambit (http://www.iro.umontreal.ca/~gambit/) is also popular, though I have less experience with it.
-----
Edit: sorry not sure if you were talking about Lua or a C-based Scheme, though I imagine it's the same.
And it's important to be able to attach to a running process and move through the inter-language call stack (e.g. when debugging a deadlock under MPI (distributed-memory)). I haven't found a high-level language that offers this sort of interoperability, but I'd love to hear suggestions.
Which of the Lua debuggers is your favorite?
GDB works across the language boundary, though. As far as it's concerned, Lua is just a C library.
I wrote a Lua remote debugger myself years ago. A nice trick was that you can associate a string with a chunk of code when you load the code. Then you can retrieve that string from the debug API based on the current instruction. I used that to make a table of "chunk name" to "source" as a global variable in LUA. That made it easy for the debugger to retrieve the source regardless of where it came from (file vs interactive console vs who knows what).
guessing you cant do this with a compile to C style implementation.
Example with discussion on LtU: http://lambda-the-ultimate.org/node/2796
D also looks interesting --- as a much saner C++.