Zephir - Ze(nd Engine) Ph(p) I(nt)r(mediate) - is a high level language that eases the creation and maintainability of C-extensions for PHP. Zephir extensions are exported to C code that can be compiled and optimized by major C compilers such as gcc/clang/vc++. Functionality is exposed to the PHP language. Zephir aims for near full interoperability with existing PHP code.
Main features:
- Both dynamic/static typing
- Reduced execution overhead compared with full interpretation
- Restricted procedural programming, promoting OOP
- Memory safety
- Ahead-of-time compiler
Compiler design goals:
- Multi-pass compilation
- Type speculation/inference
- Allow runtime profile-guided optimizations, pseudo-constant propagation and indirect/virtual function inlining
xx is the parser for the language:
You will need json-c installed on your machine:
Compilation:
./generate
Compile the extension:
./zephir
The code produced is placed in e 4C77 xt/, there you can perform the standard compilation:
cd ext/
phpize
./configure --enable-test
make && sudo make install