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-beta1 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 October 2008. The first beta release of phc version 0.2.0 has been made available. Changes since the alpha include fixing garbage collection in the compiler, and bringing the documentation up-to-date. Read the announcement for more details.

12 October 2008. As part of a push for greater contributions to phc, the php-internals mailing list has been opened up for general membership.

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.

See the news archive for older news.

Recent project activity:

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

r1937 | paul.biggar | 2008-11-21 13:27:41 +0000 (Fri, 21 Nov 2008) | 16 lines

Add an optimization to speed up loops controlled by boolean variables. All our for-loops appear like this in the MIR, due to weird lowering during conversion to the HIR. It is not possible (AFAICT) to fix this in the HIR, because lowering to a more efficient form will always fail at an edge case (typically involving a continue statement).

This pass identifies if statements with two predecessors, where the block variable is set to true in one predecessor, and set to false in one successor. In this case, it splits the control block. Each control block will only have one possible value, so SCCP and DCE will remove the boolean assignments and the control blocks.

This reduces the time spent in the benchmark by about 4%.

A number or organizational changes were required: Optimization_pass now has a require_ssa field. Without it, SSA wont be built (the Remove_loop_booleans pass doesnt need it). List now has a has() method, which returns whether an element is in the list. Basic_blocks now have a clone method, though this is only implemented for Branches, for now.

Some minor bug fixes are included: debugging information before cfg_dumnp was called didnt have any block numbers (they all used 0). has_def didnt work for non-SSA form.

r1936 | paul.biggar | 2008-11-21 13:14:44 +0000 (Fri, 21 Nov 2008) | 2 lines

Update comments.

r1935 | paul.biggar | 2008-11-20 21:40:32 +0000 (Thu, 20 Nov 2008) | 2 lines

I broke records/run (and probably any client of complete_exec in a previous commit).