phc logo

Contributors needed

phc is looking for contributors to help complete the compiler, add new features, and further test existing functionality. Developers who are familiar with (or willing to learn) the PHP C API are particularly desired, but anybody with a knowledge of C++, C or PHP are appreciated. See the Developers and Contributors for more details.

New release: phc version 0.2.0-alpha1 is available for download. The documentation will be updated soon. Please report bugs to phc-general [at] phpcompiler.org.

What is phc?

phc is an open source compiler for PHP with support for plugins. In addition, it can be used to pretty-print or obfuscate PHP code, as a framework for developing applications that process PHP scripts, or to convert PHP into XML and back, enabling processing of PHP scripts using XML tools.

phc for PHP programmers (See Manual):

  • Compile PHP source into an (optimized) executable.
  • Compile a web application into an (optimized) extension.
  • Pretty-print PHP code.
  • Obfuscate PHP code (--obfuscate flag - experimental).
  • Combine many php scripts into a single file (--include flag - experimental).
  • Optimize PHP code using classical compiler optimizations (in the dataflow branch - very experimental).

phc for tools developers (See Developers and Contributors):

  • Analyse, modify or refactor PHP scripts using C++ plugins.
  • Convert PHP into a well-defined XML format, process it with your own tools, and convert it back to PHP.
  • Operate on ASTs, simplified ASTs, or 3-address code.
  • Analyse or optimize PHP code using an SSA-based IR (in the dataflow branch - very experimental).

News

21 September 2008. phpcompiler.org has been given an overhaul. Although most of the changes are behind the scenes, we've added a contribution page, to make it easier for potential contributors to contribute to phc.

21 September 2008. The first alpha release of phc version 0.2.0 has been made available. The major change is this is the first version which compiles PHP code into an executable, or into a C extension. This allows speed-ups of approximately 1.50 (programs takes 33% less time to run).

17 January 2007. The phc SVN repository is now publicly available. Read the announcement for more details.

See the news archive for older news.

Recent project activity:

There were 42 commits in the last 7 days. Most recent:

r1758 | paul.biggar | 2008-10-06 22:58:56 +0100 (Mon, 06 Oct 2008) | 8 lines

Replace Push_array with Assign_next, and add

$x =& $y[];

which has Access_next on the RHS. This is only allowed by reference, though this isnt checked.

Fix the shredder to allow [] even when it isnt the first element. This doesnt fix later lowering or codegen, however.

r1757 | paul.biggar | 2008-10-06 20:00:41 +0100 (Mon, 06 Oct 2008) | 2 lines

Refactor SSA calculation out of CFG, into SSA.{h,cpp}

r1756 | paul.biggar | 2008-10-06 19:35:31 +0100 (Mon, 06 Oct 2008) | 2 lines

Move SSA files into src/optimize/ssa/