I wanted to write native code CGI app's in Lazarus which I could convert to PHP. So, here is Pas2Php.
http://www.wascal.net/pas2php/(Note: The source code as of now is also attached to this post)
When you run the demo project in Lazarus, the unit "index.pas" and all its available units are translated to php files. It then opens the url to where the php file is being served.
The demo can be run a php script or as native cgi. More testing is needed and I'll be adding more PHP functions to the Pascal libraries. The demo also shows how to write Pascal versions of common PHP functions which will run if the app is used as CGI.
The main issues atm are:
functions which can not be found (which have no parameters)
Workaround: Use UnknownFunction() to show you are calling a function, and not accessing a variable.
Calls to methods which can not be found:
Workaround: Use Self.UnknownFunction()
Adding strings together which are unknown variables.
Workaround: Use GetApple() + ' ' + GetOrange() to force string concatenation.
What Im thinking is, using PascalScript to "syntax check" code, and then translate to php. Since PascalScript is a subset of PasTree, I should be able to get close to a 100% translation success rate.
Anyway, cheers