
Kira - A language that compiles to PHP - mk
http://www.mathgladiator.com/projects/kira/
======
Zak
I 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#.

------
aasarava
It 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
> 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.

------
koblas
While 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
Joel Spolsky's language Wasabi compiles down to VBScript and PHP and
JavaScript.

<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._

------
ComputerGuru
I 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 :)

~~~
emmett
Perhaps 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
Perhaps. 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.

------
omouse
Kira doesn't look like fun to program in, but the idea of translating to PHP
is interesting.

