How does the Runtime Converter compare to Facebook's HipHop?

On the face of it, HipHop, which is Facebook's source code converter from PHP into C++, would be a very similar project to the Runtime Converter which converts PHP into Java/Swift/C#. In fact, HipHop serves as an excellent example of how it is possible to convert PHP and have it run flawlessly. Where HipHop and the Runtime Converter differ is in their primary goals. The primary goal of HipHop was to speed up PHP and reduce costs. The Runtime Converter also has this potential, especially with the Swift and C# versions (and with developer work + optimization also the Java), but one of its main goals is to enable developer productivity using the new languages. HipHop took relatively simple code

How does the Runtime Converter compare to Quercus?

Quercus is a Java implementation of PHP 5 developed by Caucho and implemented inside of their application server called "Resin". The most significant difference between Quercus and the Runtime Converter is that Quercus is a way for you to run PHP on the JVM, rather than a way for you to convert your PHP source code into Java. It is offers a way for you to call Java from PHP, but it is not a way to convert your site from PHP into Java. The Runtime Converter not only compiles to Java, but provides you with a Java project source that you can edit. Another advantage that the Runtime Converter has is that using JNI it has access to the real PHP function implementations. Quercus has implemented th

How does the Runtime Converter work?

The Runtime Converter produces code (right now in Java) that is automatically converted from PHP. It has a dependency on a library of helper functions and on the PHP runtime library itself, which is used to provide the library of standard functions. When the user calls a method from one of the user-space classes that they converted, this call is made in the target language. The functions, classes, and include files from their project are all converted to code in the target language, which is then compiled and linked with the runtime library. When the converter encounters code that calls on of the php standard library functions, or a function from an extenseion, it maps that call to the runti

Runtime Converter Unit Testing

One of the main goals of the runtime converter is to be able to run converted PHP code on another platform with exactly the same behavior as the souce php code. To make this work, and to prevent regressions from constant changes, we have invested in developing a large number of unit tests. Some of these relate to the C++ wrapper around the php standard library, but the majority of them are actually written in PHP. In fact, we run a large number of unit tests directly from the ".phpt" files that php uses to test its own implementation. When a source file or a group of source files are tested, the unit-test first runs the conversion process on the php file(s). It then runs the source PHP file

Why do people complain about PHP?

The reason that people complain about PHP as a language is that it was not developed from scratch as a "programming language" per-se, but rather evolved from a small webpage project ("Personal Home Page") into a programming language. The result is something that is very practical, but which is full of many design decisions that make no sense at all. Basically, it is the way that it is (in many cases) because of some historical development, rather than outright design. Nevertheless, from a practical standpoint, none of that matters very much. You can find a long, but also outdated list of common complaints in the popular post "PHP a Fractal of Bad Design". One very valid complaint, though, is

Why is there no automated type detection in the Rutime Converter?

While adding automated type detection was on of the early goals of the Runtime Converter, it has since become completely removed from the project's roadmap. One of the reasons that it was removed is that a much more important feature is the ability of the converted software to work exactly as it was intended to in the source language. To do this, it was important to make dynamic binding to function and method calls, so that the number of arguments could vary, as it does in PHP. That is not to say that it could not be done in some places to match method parameters exactly, but the complexity of doing so and making the project work is enormous, and that is not even automated type detection, on

How can PHP be converted to Java?

In general, there is not much about PHP that can't be converted to Java, though it is not particularly easy to do. What needs to be done is to convert the code and include a support library to match the features that aren't available in the target language. Each modern language has its own set of built in functions. In PHP, these consist of the standard library functions, as well as a number of popular extensions. In Java, that consists of various built in packages. For a converter to work, it needs to support all of those built in functions. An interesting fact of modern languages is that they are often written in two languages, one of which is usually C/C++. PHP's standard functions and ex

PHP to Swift Progress

We have successfully developed the larger part of the helper library for Swift, including function calls (with return value, arguments, and output), exceptions, array helper class (native) and native array functions. The reason we did this now was to try out a "Java to Swift" converter (https://github.com/eyob--/j2swift). The converter was a great help, but the process was painstaking to get that last 1% of syntax differences correct. One very interesting difference between the Swift and Java implementations is nearly all of the code that for Java JNI was written in C/C++, we were able to write in Swift directly. The direct interface with PHP is still written in C++, and we added a small wra

What platforms will the upcoming PHP to Java Converter support?

The PHP to Java conversion process creates code linked to a separate library (provided as a .jar) that provides various helper functions and classes used to make the conversion process work. It has a JNI connection to a library that connects to the real PHP codebase and forwards basic PHP standard library + extension function calls. This also means that the library will only work on those platforms for which a JNI library file is provided. For the first release, we will be providing library files for macOS and for Ubuntu 16.04 (64-bit). This narrow choice of platforms will make it easier to support the public release.

Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

© 2017 RuntimeConverter