7 ms·
Amplifying C
- mahmud 17y agoGood spirit! 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/ http://common-lisp.net/project/parenscript/ Regards. - someone who compiles lisp to native object code
- malkia 17y agoThere is also Stella used for PowerLoom - http://www.isi.edu/isd/LOOM/PowerLoom/ http://www.isi.edu/isd/LOOM/PowerLoom/ 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.
- mahmud 17y agoIt looks like a constraint programming language; sorta like CLIPS/LISA, am I right?
- rw 17y agoHave you looked at C--?
- mahmud 17y agoHave you? I have been a Norman Ramsey stalker since 1997, I dabbled in every project the man ever touched, and C-- is not what the author needs. He wants C performance with higher abstractions. C-- is C performance with assembly abstractions (i.e. lower)
- eru 17y agoYes, though C-- might be a good target for his amplify system, still. D also looks interesting --- as a much saner C++.
- rw 17y agoI predicted that my comment would be taken pejoratively, but I didn't correct for it. All I wanted to know is, had C-- been looked at? Thanks for putting it into perspective.
- pheon 17y agoWhats the point of inventing yet another language? Its far better to use existing and proven languages for both a completeness/stood.the.test.of.time point and time it takes a new developer to get up to speed. 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.
- nex3 17y agoAll languages (except maybe Lisp, COBOL, and FORTRAN) were "yet another language" at some point. This is how innovation happens.
- pheon 17y agoyet with those languages were derived from constructs in math - new is always relative to the context. Guess it depends on whats the advantage of doing this is? just for fun? or for a serious practical application.
- nex3 17y agoArguably the languages were not "yet another" in the sense that they were the first application of those concepts to executable code. But your point is well taken: everything has its roots in history. I would say most reasons for creating new languages -- for fun, for production usage, as a learning experience -- are good.
- silentbicycle 17y agoNitpick: It's 'Lua', not 'LUA'. (It's Portuguese for "moon", and its predecessor was called 'Sol'.) While I too prefer C+Lua, Schemes that compiler to C are another option. Chicken Scheme (http://www.call-with-current-continuation.org/ http://www.call-with-current-continuation.org/) is quite good. Gambit (http://www.iro.umontreal.ca/~gambit/ http://www.iro.umontreal.ca/~gambit/) is also popular, though I have less experience with it.
- allenbrunson 17y agoi like the author's writing style, and i think he's onto something. i've long hoped for a decent language for writing low-level stuff. so far, c++ is the worst, except for all the alternatives. 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.
- csmeder 17y ago" i've long hoped for a decent language for writing low-level stuff." Have you tried Forth? It is great at low-level stuff.
- allenbrunson 17y agowell, how am i going to compile forth into my iphone app? it usually comes down to something like that.
- jrockway 17y agoProbably the same way you compile C into an iPhone app. But you said low-level. iPhone apps are high-level.
- eru 17y agoForth isn't compiled most of the time. So go and write yourself a Forth interpreter in C or Assembler for your iPhone. It's (relatively) easy.
- allenbrunson 17y agoso my options boil down to dealing with c++'s warts or writing my own forth interpreter? heh! i think i can see why the status quo has persisted for so long. (not trying to be snarky. if you have written your own forth interpreter, then you are a lot more hardcore than me.)
- 17y ago
- gruseom 17y agoI've been wondering for a while why the obvious value in this approach isn't more widely recognized. Perhaps its time has come? I hope so! A Parenscript for C is a good idea. It would be exciting to see this sort of library come out of the game industry.
- romland 17y agoI do think it is recognized. 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. :)
- gruseom 17y agoThe biggest problem with these things is [...] 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.
- richcollins 17y agoLuaJit is so fast now, why not LuaJit + C where needed?
- malkia 17y agoLuaJit is awesome, but he talks purely about using Lisp to describe "C" semantics. 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.
- silentbicycle 17y agoThat's a very different approach. This is closer to using Lisp to generate C, whereas Lua+C usually involves a multilayered design: you write your engine in C or C++, write or generate a simple Lua wrapper for its API, and then the do logic in Lua, moving hotspots to C as necessary. (http://c2.com/cgi/wiki?AlternateHardAndSoftLayers http://c2.com/cgi/wiki?AlternateHardAndSoftLayers, as they say.) As a bonus, the cross-language boundaries are often natural seams for containing complexity. 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 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.
- rincewind 17y agolooks like the function language part of the cola framework: http://piumarta.com/software/cola/coke.html http://piumarta.com/software/cola/coke.html Example with discussion on LtU: http://lambda-the-ultimate.org/node/2796 http://lambda-the-ultimate.org/node/2796
- delackner 17y agoThe first link has no context, just a reference. The second link goes to a page with 3 comments and no body text, just a 1 paragraph abstract. The link in the abstract is a 404.
- olliesaunders 17y agoRelated discussion: http://news.ycombinator.com/item?id=888643 http://news.ycombinator.com/item?id=888643