Home Β» Php Β» PHP compiler – PHP

PHP compiler – PHP

Posted by: admin February 22, 2020 Leave a comment

Q(Question):

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

Nikola Skoric wrote:

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

oh you sick freak. You want compiled binaries for what reason?
efficiency??? use a language that allows efficiency then…

mwhaha…

J

A(Answer):

Hi J,
On Sun, 07 Mar 2004 23:57:47 +0000, J Taylor <[email protected]> wrote:

Nikola Skoric wrote:

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

oh you sick freak. You want compiled binaries for what reason?
efficiency??? use a language that allows efficiency then…

He might want it to distribute it to people that are not able to set
up a webserver.

if this is the case, have a look at MicroWeb. Its not free though.

HTH, Jochen

mwhaha…

J


Jochen Daum – Cabletalk Group Ltd.
PHP DB Edit Toolkit — PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/

A(Answer):

Jochen Daum <jo*********@cans.co.nz> wrote in message news:<rf********************************@4ax.com>. ..

He might want it to distribute it to people that are not able to set
up a webserver.

if this is the case, have a look at MicroWeb. Its not free though.

But then he should write a simple executable that starts apache with
the right config file. The only real reason for a compiler is to
protect the copyright of your source code. And for this there is a
zend solution availabl.e

A(Answer):

In article <6e**************************@posting.google.com >,
ll*****@web.de says…

Jochen Daum <jo*********@cans.co.nz> wrote in message news:<rf********************************@4ax.com>. ..

He might want it to distribute it to people that are not able to set
up a webserver.

if this is the case, have a look at MicroWeb. Its not free though.

But then he should write a simple executable that starts apache with
the right config file. The only real reason for a compiler is to
protect the copyright of your source code. And for this there is a
zend solution availabl.e

Zend solution? Can you explaint that a little bit?


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

In article <40***********************@news-text.dial.pipex.com>,
[email protected] says…

Nikola Skoric wrote:

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

oh you sick freak. You want compiled binaries for what reason?
efficiency??? use a language that allows efficiency then…

mwhaha…

No. See, you didn’t understand my question correctly. I don’t actually
need a PHP compiler, what I need is an *information* wether that
compiler exists. And why’s that? Becouse my team and I might be doing a
PHP compiler as a student project for my Comiler Design course at
University (I, as a group leader, have 10 people and 4 months on my
hands to build a comiler of my own). So, it would be very nice to have
"nobody did it before" in my project documentation. And I can write that
if I’m not sure, right?


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

Nikola Skoric wrote:

(…)
Zend solution? Can you explaint that a little bit?

"Starting at $960":
http://www.zend.com/store/products/zend-encoder.php

Rudi

A(Answer):

That would be a nice thing to do.

AFAIK, so far there is a PHP compiler that creates code that is interpreted
by another executable. That is the case of "Zend Encoder" and "Zend
Optimizer" that runs the compiled code. Guess this can be classified as
Java: bytecode generator and an interpreter.


Elias
"Nikola Skoric" <ni*******@net4u.hr> wrote in message
news:[email protected]

In article <40***********************@news-text.dial.pipex.com>,
[email protected] says…

Nikola Skoric wrote:

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

oh you sick freak. You want compiled binaries for what reason?
efficiency??? use a language that allows efficiency then…

mwhaha…

No. See, you didn’t understand my question correctly. I don’t actually
need a PHP compiler, what I need is an *information* wether that
compiler exists. And why’s that? Becouse my team and I might be doing a
PHP compiler as a student project for my Comiler Design course at
University (I, as a group leader, have 10 people and 4 months on my
hands to build a comiler of my own). So, it would be very nice to have
"nobody did it before" in my project documentation. And I can write that
if I’m not sure, right?


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

On 2004-03-08, Nikola Skoric wrote:

In article <40***********************@news-text.dial.pipex.com>,
[email protected] says…

Nikola Skoric wrote:

> Is the a PHP compiler? A program that compiles PHP code to executable
> which doesn’t need php interpreter to execute…
>

oh you sick freak. You want compiled binaries for what reason?
efficiency??? use a language that allows efficiency then…

mwhaha…

No. See, you didn’t understand my question correctly. I don’t actually
need a PHP compiler, what I need is an *information* wether that
compiler exists. And why’s that? Becouse my team and I might be doing a
PHP compiler as a student project for my Comiler Design course at
University (I, as a group leader, have 10 people and 4 months on my
hands to build a comiler of my own). So, it would be very nice to have
"nobody did it before" in my project documentation. And I can write that
if I’m not sure, right?

There have been a few projects started along these lines but none seem
to have reached any kind of usable solution yet. There was a thread
discussing this on the php-internals mail list recently which mentions
some of the projects and issues. You can follow the thread from the
archives here:
http://marc.theaimsgroup.com/?l=php-…7956215002&w=2

HTH

Mike Peters
mike [-AT-] ice2o [-DOT-] com
http://www.ice2o.com

A(Answer):

Nikola Skoric wrote:

In article <40***********************@news-text.dial.pipex.com>,
[email protected] says…

Nikola Skoric wrote:

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

oh you sick freak. You want compiled binaries for what reason?
efficiency??? use a language that allows efficiency then…

mwhaha…

No. See, you didn’t understand my question correctly. I don’t actually
need a PHP compiler, what I need is an *information* wether that
compiler exists. And why’s that? Becouse my team and I might be doing a
PHP compiler as a student project for my Comiler Design course at
University (I, as a group leader, have 10 people and 4 months on my
hands to build a comiler of my own). So, it would be very nice to have
"nobody did it before" in my project documentation. And I can write that
if I’m not sure, right?

Out of interest I have seen a set of php scripts (non free and
non-public) which convert php code (limited scope) into C or Java source
code, then call gcc | javac.

This is slightly more efficient way of writing a "quick" compiler as the
devlopers take advantage over the gcc and javac developers time and
effort in writing the compiler technology as opposed to having to
develop all the code optimisers themselves.

However I still oppose the idea of handing out a php compiler – if it
could not actually produce efficient code, is handing out this tool
going to promote peoples use of it?

J

A(Answer):

"lallous" <la*****@lgwm.org> wrote in message news:<c2*************@ID-161723.news.uni-berlin.de>…

That would be a nice thing to do.

AFAIK, so far there is a PHP compiler that creates code that is interpreted
by another executable. That is the case of "Zend Encoder" and "Zend
Optimizer" that runs the compiled code. Guess this can be classified as
Java: bytecode generator and an interpreter.

I looked at the 5.0 source code last week and it seems to be built in
now. At least there is a bytecode maybe not an optimized one, but i
don’t know what could be really optimized.

A(Answer):

In article <40***********************@news-text.dial.pipex.com>,
[email protected] says…

However I still oppose the idea of handing out a php compiler – if it
could not actually produce efficient code, is handing out this tool
going to promote peoples use of it?

That question is of no importance to me at this point. Now my main
concern is to get as much points for my crew and me, so we could get
better grades. *BUT* as I have great intrest in optimizing algorithms,
and I’m still 2 years away from my University diploma, there is a great
probability that I might be doing some optimizing to… and after I’m
finished with the project it would be a realy nice start for a PHP
compiler… if my University alowes me to publish it under GPL.

<egomaniac>
After all, Linux too was born as a student project, right? πŸ™‚
</egomaniac>


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

Nikola Skoric a Γ©crit le 07/03/2004 :

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

Do you know Google? 509000 answers and out of this in 2mn :
Individuals Projects running :
PHPblender
PHP|Architect
PHP_Sharp
(none seem to be completed)

Commercial solutions :
www.ioncube.com
www.Zend.com

A(Answer):

Nikola Skoric wrote:

In article <40***********************@news-text.dial.pipex.com>,
[email protected] says…

However I still oppose the idea of handing out a php compiler – if it
could not actually produce efficient code, is handing out this tool
going to promote peoples use of it?

That question is of no importance to me at this point. Now my main
concern is to get as much points for my crew and me, so we could get
better grades. *BUT* as I have great intrest in optimizing algorithms,
and I’m still 2 years away from my University diploma, there is a great
probability that I might be doing some optimizing to… and after I’m
finished with the project it would be a realy nice start for a PHP
compiler… if my University alowes me to publish it under GPL.

mmm you might then be interested in compiling to some other bytecode –
you could compile to native but you might also want to try compiling a
set of functions (remembering that the entire php compiler spaning all
function calls would take a long time (years)). you could compile a set
of standardised functions into corresponding byte code.

You might also want to look at the fact that PHP itself uses library
calls so most of the function code will be allready written for you – in
this case you might be faster generating C code and compiling that. Are
there any PHP developers on the list?

<egomaniac>
After all, Linux too was born as a student project, right? πŸ™‚
</egomaniac>

IIRC not as a university project.
<recall title="top ten flame wars of the past">Indeed, Tanenbaum (who
although might be as communicative as a trout, is possibly the worlds
best authority on Operating Systems), claimed (with good reason) that
Linux was written and designed in the wrong manner, and that if it had
been written for His course, then Linus would have been failed.
Interestingly enough, it seems Linus only even bothered to write it
because he was bored of playing Prince of Persia… Linus Torvalds – a
game geek at heart?</recall>

J

A(Answer):

"Nikola Skoric" <ni*******@net4u.hr> wrote in message
news:[email protected]

(snip)
No. See, you didn’t understand my question correctly. I don’t actually
need a PHP compiler, what I need is an *information* wether that
compiler exists. And why’s that? Becouse my team and I might be doing a
PHP compiler as a student project for my Comiler Design course at
University (I, as a group leader, have 10 people and 4 months on my
hands to build a comiler of my own). So, it would be very nice to have
"nobody did it before" in my project documentation. And I can write that
if I’m not sure, right?


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

If I may say, if you have never written a compiler before, do attempt a php
compiler, stick to a language that is more suited for compiling.

PHP has too many functions, that can limit compiling, for example, the
require() function can be used like a C-style include, and compiled, but you
lose out on the include() function, becouse a lot of time people need to
include editable (such as forms erc..) files at run time, therefore those
files can not be compiled. Actualy even some require() files can not be
compiled, becouse they contain config variables that need to be editied by
the user.

So you compiler would have to have some added directives to tell it whether
to compile the require/include files, and it would have to have a built in
interpeter in the run time, so as to interpet the include files that were
not compiled. (also file scripts that use the eval command)

Here is an example:

main file:
<?php
include("sub.php");
print "Version: $ver\n";
print "Max allowed users: $maxUsers\n";
?>
include file, that can not be compiled becouse user has to define settings
sub.php
<?php
$ver = "1.0";
$maxUsers = 20;
?>
Also, there are a lot of people (my self included) that write admin pages
that write php config pages, that are included in a script, I also write
selfmodifying scripts.

Now I am not saying it can not be done, just rather complex due to the
robustness of php. This is why alot of compilers compile to P-Code. not true
cpu instructions.

Well you have one good advantage, you have access to the php source πŸ™‚

Just my 2 cents.


Mike Bradley
http://www.gzentools.com — free online php tools

A(Answer):

Hello,

On 03/08/2004 05:34 PM, CountScubula wrote:

No. See, you didn’t understand my question correctly. I don’t actually
need a PHP compiler, what I need is an *information* wether that
compiler exists. And why’s that? Becouse my team and I might be doing a
PHP compiler as a student project for my Comiler Design course at
University (I, as a group leader, have 10 people and 4 months on my
hands to build a comiler of my own). So, it would be very nice to have
"nobody did it before" in my project documentation. And I can write that
if I’m not sure, right?

If I may say, if you have never written a compiler before, do attempt a php
compiler, stick to a language that is more suited for compiling.

PHP has too many functions, that can limit compiling, for example, the
require() function can be used like a C-style include, and compiled, but you
lose out on the include() function, becouse a lot of time people need to
include editable (such as forms erc..) files at run time, therefore those
files can not be compiled. Actualy even some require() files can not be
compiled, becouse they contain config variables that need to be editied by
the user.

He never said that he wanted to develop a compiler that generates an
executable that works by itself. Anybody can develop a compiler that
links to libphp.a and the necessary parts of Zend engine. Over time the
compiler could be optimized to replace some PHP function calls with
native C code.

Actually, the compiler could be Just In Time (JIT) and be transparently
integrated in the PHP runtime execution for maximizing the performance
and keeping the flexibility.

Regards,
Manuel Lemos

PHP Classes – Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews – Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage – Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

A(Answer):

Dana Mon, 08 Mar 2004 20:24:31 +0100,
Jedi121 <je*********@free.fr.Removethis> kaze:

PHP_Sharp

Hm, hm, this one is interesting. I myself have been thinking about
PHP -> MSIL compiler… Thanks for the tip!


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

Dana Mon, 08 Mar 2004 19:51:53 +0000,
J Taylor <[email protected]> kaze:

Nikola Skoric wrote:

That question is of no importance to me at this point. Now my main
concern is to get as much points for my crew and me, so we could get
better grades. *BUT* as I have great intrest in optimizing algorithms,
and I’m still 2 years away from my University diploma, there is a great
probability that I might be doing some optimizing to… and after I’m
finished with the project it would be a realy nice start for a PHP
compiler… if my University alowes me to publish it under GPL.
mmm you might then be interested in compiling to some other bytecode –

Yes, I’m thinking about compiling to MSIL (.NET Framework language) because
of all the built in methods that would minimize the effort of writing the
built in functions. But, anyway, my compiler doesn’t have to have more than
15 built in functions, my aim is to show to my teacher that I understand the
way compilers are dedigned, no to build a full scale compiler able to whash
the dishes…
you could compile to native but you might also want to try compiling a
set of functions (remembering that the entire php compiler spaning all
function calls would take a long time (years)).

That’s the reason I don’t have to be able to compile all ot PHP functions.
You might also want to look at the fact that PHP itself uses library
calls so most of the function code will be allready written for you – in
this case you might be faster generating C code and compiling that.

Hmmm… no, to complicated. Our course is about converting higher languages
to assembly languages, crosscompilation is not an option.
Are
there any PHP developers on the list?

Which list? πŸ™‚
<recall title="top ten flame wars of the past">Indeed, Tanenbaum

Is that the MINIX guy?


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

"Nikola Skoric" <ni*******@net4u.hr> wrote in message
news:[email protected]

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

Nikola,

I have been thinkering about possibilites and implications of writing
another php implementation. My expirience is that first thing that you would
have to ask yourself is "What is PHP actually?". Is it just a core of the
language (syntax and semantics). Is the library also part of it? The whole
library or just some "core" parts of library? Is the web server interface
also part of the language implementation?

Here are most troublesome aspects I have came uppon:

* there is no formal definition of the language and the system. The whole
thing relies on the concept "implementation is definition". For instance
there is no formal description of the syntax, instead, you digg into the
bison and flex sources and hack your way from there. I still keep finding
things in implementation that make system behave differently than what I
would expect it normaly.

* library. It is a precious resource, more or less you can find interface to
allmost anything you would ever like to use. Anyway it is huge, and written
by many. Writing it from the scratch is mission impossible without very huge
resources. You can try to use existing library, and try to provide the same
interface from your execution environment, as original zend engine does so
that library feels at home. Anyway, while there are descriptions of that
interface, but I do not feel those descriptions have completness necessary
to mimic zend environment completely. Also it would still be possible that
in some library someone hacked a bit deeper than that and used some internal
knowledge of zend engine.

* if using the already exiting library you would have to choose wheater to
tray to use it in "binary compatible" or logically same way. Binary
compatible would save you from recompiling the library with all caveats that
might arouse, but forgetting the binary compatibility would allow you to at
least better fit execution model to your desires.

* you cold go mixed way with library, reimplement most important parts
(array strings ..) so that you can use your own execution envornment, and
use some tunneling to speak with old library for the rest.

* you could say that library is not part of php and implement just the core
of the language. This would of course be just an toy.

* Testing. How do you know that you have done good job in the end
(especially when you do not have formal definition avaliable)? Testing would
have to be massive in order to weed out not only bugs, but you
missunderstandings what php actually is.

* Legalize … brr… Library has been written by many, and while my
understanfding of original Zensd licence is quite liberal, I have not read
all of the copyright notices in every single source for the library. There
could be some caveats.

Anyway, since we live in the same town, you could drop me an e-mail, and we
could meet for coffe or beer, and chat from time to time about our findings.

rush

http://www.templatetamer.com/

A(Answer):

Manuel Lemos <ml****@acm.org> wrote in message news:<c2*************@ID-138275.news.uni-berlin.de>…
<snip>

He never said that he wanted to develop a compiler that generates an
executable that works by itself. Anybody can develop a compiler that
links to libphp.a and the necessary parts of Zend engine. Over time the
compiler could be optimized to replace some PHP function calls with
native C code.

So, are you suggesting bcompiler
<http://pecl.php.net/package/bcompiler> or BinaryPHP
<http://sourceforge.net/projects/binaryphp/> ?

p.s.: I never used these tools.


"I don’t believe in the God who doesn’t give me food, but shows me
heaven!"–Swami Vivekanandha
Email: rrjanbiah-at-Y!com

A(Answer):

Manuel Lemos <ml****@acm.org> wrote in message news:<c2*************@ID-138275.news.uni-berlin.de>…

He never said that he wanted to develop a compiler that generates an
executable that works by itself. Anybody can develop a compiler that
links to libphp.a and the necessary parts of Zend engine. Over time the
compiler could be optimized to replace some PHP function calls with
native C code.

But i’m 100% sure that this is nothing for a university compiler
course. Maybe it is if you only teach the tokenizer and lexical
parser. But this should take no longer then a month. Everything else
is for educational things just stupid. Writing an interpreter is a
good home work assignment, i did this with a lisp interpreter in my
student days, but using PHP in a compiler course. Oh my Buddha, please
help the unwise.

A(Answer):

On Tue, 9 Mar 2004 10:15:31 +0000 (UTC),
Nikola Skoric <ni*******@net4u.hr> wrote:

–<snip>–

Yes, I’m thinking about compiling to MSIL (.NET Framework language) because
of all the built in methods that would minimize the effort of writing the
built in functions. But, anyway, my compiler doesn’t have to have more than
15 built in functions, my aim is to show to my teacher that I understand the
way compilers are dedigned, no to build a full scale compiler able to whash
the dishes…

We were working on a Antlr parser for PHP, that is still incomplete yet.
But it does not actually contain any builtin PHP methods. It would just
parser to the point, where it’s clear, that the current token is the name
of a builtin method. Then it should lookup the name in a list of methods,
that would reference the code to execute that method. So you could add
new methods dynamically without changing the parser.

Ciao,
Andreas

A(Answer):

Hello,

On 03/09/2004 09:36 AM, R. Rajesh Jeba Anbiah wrote:

He never said that he wanted to develop a compiler that generates an
executable that works by itself. Anybody can develop a compiler that
links to libphp.a and the necessary parts of Zend engine. Over time the
compiler could be optimized to replace some PHP function calls with
native C code.

So, are you suggesting bcompiler

No, AFAIK, bcompiler is a dead project.

<http://pecl.php.net/package/bcompiler> or BinaryPHP
<http://sourceforge.net/projects/binaryphp/> ?

Maybe it would be more like this but this project seems to be dead as well.

Regards,
Manuel Lemos

PHP Classes – Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews – Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage – Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

A(Answer):

On 03/09/2004 10:35 AM, Lothar Scholz wrote:

He never said that he wanted to develop a compiler that generates an
executable that works by itself. Anybody can develop a compiler that
links to libphp.a and the necessary parts of Zend engine. Over time the
compiler could be optimized to replace some PHP function calls with
native C code.
But i’m 100% sure that this is nothing for a university compiler

Why not?

course. Maybe it is if you only teach the tokenizer and lexical
parser. But this should take no longer then a month. Everything else
is for educational things just stupid. Writing an interpreter is a
good home work assignment, i did this with a lisp interpreter in my
student days, but using PHP in a compiler course. Oh my Buddha, please
help the unwise.

What you are suggestiong seems pointless. PHP engine itself since
version 4 is already a compiler that converts PHP source and byte codes.
Writing an interpreter is like going back to the slow PHP 3 days.

If anybody writes a tool that converts PHP bytecodes into C/C++ code
that when executed does the same as when the original bytecodes are
interpreted by the Zend engine, that is also a compiler tool to me. And
yes, the base project could be developed in a month much more likely
than a PHP source to binary executable project.

Regards,
Manuel Lemos

PHP Classes – Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews – Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage – Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

A(Answer):

Manuel Lemos <ml****@acm.org> wrote in message news:<c2*************@ID-138275.news.uni-berlin.de>…

Why not?

You never took a compiler construction course in a university right ?
It makes no sense because the semantik analyse and type interference
are the more important parts. Writing parsers for simple grammers are
done in the second year. And then there is something like register
optimization etc.
Of course it is interesting to do a JIT compiler but nothing for
students course.

I only feel sorry for the poor students who have such teachers.
If anybody writes a tool that converts PHP bytecodes into C/C++ code
that when executed does the same as when the original bytecodes are
interpreted by the Zend engine, that is also a compiler tool to me.

Dynamical typing makes this impossible if you don’t change the
language with typedefs, if you do it will look like a interpreter. And
a bytecode compiler is still to a huge part nothing more then an
inpreter.

A(Answer):

Hello,

On 03/10/2004 03:34 AM, Lothar Scholz wrote:

Why not?

You never took a compiler construction course in a university right ?
It makes no sense because the semantik analyse and type interference
are the more important parts. Writing parsers for simple grammers are
done in the second year. And then there is something like register
optimization etc.
Of course it is interesting to do a JIT compiler but nothing for
students course.

I only feel sorry for the poor students who have such teachers.

Maybe, but the world is wide and not every university is equal
everywhere in the world. So, it is possible that for the original poster
university, the teachers could be more open minded and accept different
types of project proposals.

If anybody writes a tool that converts PHP bytecodes into C/C++ code
that when executed does the same as when the original bytecodes are
interpreted by the Zend engine, that is also a compiler tool to me.

Dynamical typing makes this impossible if you don’t change the
language with typedefs, if you do it will look like a interpreter. And
a bytecode compiler is still to a huge part nothing more then an
inpreter.

I don’t know how much you know from what Zend op codes that the Zend
engine executes at run time. What I can tell you is that plenty can be
done to benefit from compilation to C/C++ .

Even if no significant speedup would be possible, the fact that it would
generate a binary executable would be already a benefit for those that
would like to provide their code in easy to reverse-engineer format.

In fact, one of the major reasons why PHP is not taken seriously in the
business world is the lack of real binary compiler tools or at least
tools that let you bundle compiled code in an easy to sell world.

Sure there are commercial encoders that cost money. But considering that
most other languages provide free tools to compile their code and
generate standalone applications that do not depend on commercial
extensions to run, many people just drop PHP as a viable solution to
develop their products.

Regards,
Manuel Lemos

PHP Classes – Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews – Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage – Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

A(Answer):

Dana Wed, 10 Mar 2004 03:57:49 -0300,
Manuel Lemos <ml****@acm.org> kaze:

Hello,

On 03/10/2004 03:34 AM, Lothar Scholz wrote:

Why not?

You never took a compiler construction course in a university right ?
It makes no sense because the semantik analyse and type interference
are the more important parts. Writing parsers for simple grammers are
done in the second year. And then there is something like register
optimization etc.
Of course it is interesting to do a JIT compiler but nothing for
students course.

I only feel sorry for the poor students who have such teachers.

Maybe, but the world is wide and not every university is equal
everywhere in the world. So, it is possible that for the original poster
university, the teachers could be more open minded and accept different
types of project proposals.

No, he isn’t πŸ™‚ Our compiler has to have lexical analizer, syntax
analizer, semantical analizer, then it has to produce some kind of
middle-source on which the optimization is done and that that optimized
mid-lang goes to assembler (I might have missed something, this week the
teacher started lecturing the syntax analizer, so I’m not sure to which
extent we’ll have to go with the later parts). JIT compiler is to simple
to make a project like this. I mean, bytecode don’t even have loops, do
they? Syntax tree of a bytecode program wouldn’t be a much of a tree
anyway… more something like a bush πŸ™‚ *IF* I understood the paradigma
of bytecode correctly.


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

Nikola Skoric wrote:

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

check this http://www.triplehash.com/content.php?id=26


kreso
http://www.plus.hr/cgi-bin/aff/g.o/gdprom

A(Answer):

No, he isn’t πŸ™‚ Our compiler has to have lexical analizer, syntax
analizer, semantical analizer, then it has to produce some kind of
middle-source on which the optimization is done and that that optimized
mid-lang goes to assembler (I might have missed something, this week the
teacher started lecturing the syntax analizer, so I’m not sure to which
extent we’ll have to go with the later parts). JIT compiler is to simple
to make a project like this. I mean, bytecode don’t even have loops, do
they? Syntax tree of a bytecode program wouldn’t be a much of a tree
anyway… more something like a bush πŸ™‚ *IF* I understood the paradigma
of bytecode correctly.

Sorry what??? bytecode is just code ina binary format. ITs interpreted
by a virtual machine to allow cross-platform useage.

Bytecode is effectivly a simple assembler language – one that is as
simple as the most simple device you wish to run on – your compiler
could merge instructions (from the use of otehr markers in the byte
code) into

And bytecode wouldnt have loops??? what about threads?? your entire
stack engine system would have to be worked out (Especially for htings
like networking which you almost certainly want to do in a seperate
thread and call backwards.

Where you seriously going to generate a "linear" program of byte code,
having exploded all the loops & function calls???

just save yourself the time and effort and write a scheme compiler.
Seriously.

J

A(Answer):

Mr John Coggeshall is working on one. Check out his project page:
http://www.coggeshall.org/projects.php

Uzytkownik "Nikola Skoric" <ni*******@net4u.hr> napisal w wiadomosci
news:[email protected]

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

Nikola Skoric <ni*******@net4u.hr> wrote in message news:<sl**********************@fly.srk.fer.hr>…

Okay i see. You can learn a lot from this course, because your wisdom
about compilers is not very strong at the moment.

Good Luck.
Hope your teacher knows what he/she is doing.

A(Answer):

Dana 10 Mar 2004 22:01:54 -0800,
Lothar Scholz <ll*****@web.de> kaze:

Nikola Skoric <ni*******@net4u.hr> wrote in message news:<sl**********************@fly.srk.fer.hr>…

Okay i see. You can learn a lot from this course, because your wisdom
about compilers is not very strong at the moment.

πŸ™‚ I wouldn’t be here if it was πŸ™‚


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

A(Answer):

"Chung Leong" <ch***********@hotmail.com> wrote in message news:<QK********************@comcast.com>…

Mr John Coggeshall is working on one. Check out his project page:
http://www.coggeshall.org/projects.php

Uzytkownik "Nikola Skoric" <ni*******@net4u.hr> napisal w wiadomosci
news:[email protected]

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…


Pozdrav/Regards, Nikola [Nick] Skoric.
"…Usne, tice-rugalice – a u oku tajac
Da sam kaput sa dva lica, da sam Gospo’n Propalica…"
http://newusers.cjb.net/ – site o Usenetu na hrvatskom!

There is this one too

http://www.roadsend.com/home/index.php?pageID=compiler

A(Answer):

You could run the PHP through some type of PHP2HTML translator then compile
that to compiled HELP.

"Nikola Skoric" <ni*******@net4u.hr> wrote in message
news:[email protected]

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

A(Answer):

Hello

"Nikola Skoric" <ni*******@net4u.hr> wrote in message
news:[email protected]

Is the a PHP compiler? A program that compiles PHP code to executable
which doesn’t need php interpreter to execute…

There is RoadSend, AFAIK, the only real PHP compiler:

http://www.roadsend.com/

Regards,
Manuel Lemos

PHP Classes – Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews – Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage – Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html