2017 © Pedro Peláez
 

project recki-ct

A Compiler Toolkit for PHP.

image

recki-ct/recki-ct

A Compiler Toolkit for PHP.

  • Monday, December 22, 2014
  • by krakjoe
  • Repository
  • 57 Watchers
  • 550 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 41 Forks
  • 6 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Recki-CT

Build Status Coverage Status, (*1)

The Recki Compiler Toolkit for PHP, (*2)

Disclaimer: This is not an official Google product., (*3)

Warning: This is an incomplete work-in-progress., (*4)

Stability

Recki-CT is pre-alpha quality right now. This means that it shouldn't be used in production at all., (*5)

What Is Recki-CT?

Recki-CT is a set of tools that implement a compiler for PHP, and is written in PHP!, (*6)

Specifically, Recki-CT compiles a subset of PHP code. The subset is designed to allow a code base to be statically analyzed. This means that global variables, dynamic variables (variable-variables, variable function calls, etc) and references are not allowed., (*7)

What Isn't Recki-CT?

Recki-CT is not a re-implementation of PHP. It aims to be a limited subset of the language (one that can be staticly reasoned about)., (*8)

This means that it is not designed to replace PHP, but instead augment it., (*9)

Why?

PHP itself isn't slow. It's plenty fast enough for most use-cases. As a language, PHP has a lot of corner cases and results in a really complex engine implementation. As such, rewriting a new engine isn't going to gain you a lot. The complexity is going to be in there somewhere., (*10)

So with Recki-CT, we take a different approach. Rather than rewriting the entire engine, we sit on top of an existing engine. The compiler then can compile PHP code into native machine code which can out-perform most JIT compiled implementations (sometimes by very significant margins)., (*11)

The designed mode of operation for Recki is as an AOT (Ahead-Of-Time) compiler. Since it uses aggressive analysis and optimizations, runtime compilation would be a inefficient target. Instead, an Intermediate Representation can be cached, leaving only the final conversion to machine code to happen at runtime., (*12)

Where can I find out more?

Check out the documentation!!!, (*13)

  1. Introduction and FAQ
  2. Installation
  3. Basic Operation
  4. Types
  5. Intermediate Representation

How do I install Recki-CT?

See the Installation Documentation., (*14)

How do I use Recki-CT?

A very simple example:, (*15)

/**
 * @return void
 */
function foo($bar) {}

// Instead of using:
foo($baz);

// Use:
$foo = Jit::JitFu('foo');
$foo($baz);

Note that a docblock must be present, and must document every parameter type and the return type., (*16)

Check out the examples folder for more examples!, (*17)

License

Recki-CT is released under the Apache-2 License., (*18)

Contributing

See CONTRIBUTING.md, (*19)

And join the Google Group mailing list., (*20)

The Versions