5 ms·
Kira - A language that compiles to PHP
- omouse 18y agoKira doesn't look like fun to program in, but the idea of translating to PHP is interesting.
- Zak 18y agoI like the idea of a something-not-evil to PHP compiler, but I don't think this looks like the kind of language I had in mind. I can't help but think this is the malformed offspring of breeding ML with C#.
- koblas 18y agoWhile it's novel that it's compiling to PHP, you're still at the mercy of PHP as a language and what it has to offer. For instance, PHP lacks a true closure so if Kira want's one it'll have to build out a full system... C++ : C => Kira : PHP
- LogicHoleFlaw 18y agoJoel Spolsky's language Wasabi compiles down to VBScript and PHP and JavaScript. http://www.joelonsoftware.com/items/2006/09/01b.html http://www.joelonsoftware.com/items/2006/09/01b.html Features of Wasabi: closures, active records, lambdas, embedded SQL a la LINQ Wasabi is 100% backwards-compatible with VBScript but includes obvious improvements.
- brianr 18y agoFrom the examples page, it looks like Kira supports closures through normal PHP classes: http://www.mathgladiator.com/projects/kira/?examples http://www.mathgladiator.com/projects/kira/?examples
- ComputerGuru 18y agoI can't imagine wanting to convert another language to PHP, except for JavaScript maybe but that's not exactly useful. Now converting PHP to a different, more-useful language? that would be something :)
- koblas 18y agoThe Resin server (http://caucho.com/ http://caucho.com/) converts PHP => Java which conceptually sounds better, though I've never heard of anybody doing it for production purposes.
- ComputerGuru 18y agoI've tried it time and time again, along with Phalanger (PHP -> ILDASM) and RoadRunner (PHP -> C) and they all fail.
- emmett 18y agoPerhaps I misunderstand you, but isn't the opposite true? Presumably you would target PHP with the compiler for the same reason many people target C: it's a fairly universal language, supported on many platforms. A Ruby => PHP compiler would be very interesting because it would allow you to write Ruby code (fun!) on any system that runs PHP (many!). A PHP => Ruby compiler would be of questionable use because it would allow you to write PHP code (yuck!) on any system that runs Ruby (not so many!).
- ComputerGuru 18y agoPerhaps. However, my goal would be to take a large project already written in a nasty, buggy language and translate it to something fun to maintain and modify and easy/reliable to run.
- deleted 18y ago[deleted]
- aasarava 18y agoIt seems like there could be some performance benefits in pre-compiling or "pre-parsing" PHP. For instance, the compiler could copy specific functions or classes from an include file and save them right into the script where they're actually used -- therefore eliminating the performance hit of managing include files at runtime. Now, as to whether there's a benefit to learning an entirely new language in order to do this, I'm not so sure. Why not extend (and simplify) PHP while still using PHP syntax and grammar, the way jQuery does for JavaScript?
- paulgb 18y ago> Now, as to whether there's a benefit to learning an entirely new language in order to do this, I'm not so sure. Why not extend (and simplify) PHP while still using PHP syntax and grammar, the way jQuery does for JavaScript? jQuery can do this because, despite its quirks, JavaScript is actually a well designed programming language. It has goodies like closures, anonymous functions, and first class functions, so it is fairly extensible. PHP is just a glorified template language with wrappers to C functions.