-
Notifications
You must be signed in to change notification settings - Fork 17
/
README
115 lines (82 loc) · 3.84 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
= Roadsend PHP: Raven (rphp) =
This is the development site for the rewrite of Roadsend PHP (rphp), based on LLVM and a new C++ runtime. It is an open source, liberally licensed project.
You can find the latest summary on recent developments on http://roadsend-php.blogspot.com
Features/Goals include:
* Highly optimized, JIT or static compiled native binaries (via LLVM)
* PHP source level analysis and optimization
* Rich diagnostics and error messages
* Modular design
* Clean and easy runtime and extension API
* Full unicode support
* Latest language features (e.g. PHP5 objects, exceptions, namespaces, lambda functions, etc)
* Portability, Speed, Security
Unlike our previous project, we are not aiming for 100% compatibility with Zend Engine based PHP.
== Current Status ==
* CMake build system
* Runtime library
* Runtime variable representation
* Port of basic runtime system layout
* Standard Extension started
* Commandline front end
* Compile stand alone
* Run in JIT
* Compiler and Analysis
* Full unicode preprocessor/lexer/parser in place
* Pass system for AST tree traversal and transforming
* Some code (IR) generation (detailed progress list coming soon)
* Static analyzer which dumps (in XML)
* Tokens
* AST
* Generated IR
* Various analysis passes
* Port of [http://phpcompiler.org phc] optimizer passes
* Runtime Test Suite (CppUnit and PHP based)
Development currently takes place on Linux x86 (32 and 64) and OSX, but other platforms will be supported.
If you are looking for a fully functioning PHP compiler that works right now, please see our [http://code.roadsend.com/pcc original implementation] instead.
If you'd like to contribute, please contact us or join us in #roadsend on irc.freenode.net
== Requires ==
* [http://llvm.org LLVM] 3.0 with clang++
* [http://boost.org Boost] 1.38+ (only headers required, no libraries)
* [http://cmake.org CMake] 2.6+
* [http://icu-project.org ICU] 4.2+
* [http://gmplib.org GMP] 4.3.1+
== Docs ==
* [http://roadsend-php.blogspot.com Development Blog]
* [http://code.roadsend.com/docs/doxygen/annotated.html Doxygen Source Documentation]
== Source ==
Browse the source at:
https://github.com/weyrick/roadsend-php-raven
== Build ==
rphp uses the CMake build system. Basic *nix instructions:
* create "build" directory inside of rphp
* in the build directory, type "cmake .."
* make
Note that an in-tree build is not recommended, you should create a separate build directory.
== Sample Checkout and Build Session ==
Assuming you have the prerequisites installed, a sample checkout and build session might look like this:
~$ cd rphp
~rphp/$ mkdir build
~rphp/$ cd build
~rphp/build$ cmake ..
(... output ...)
~rphp/build$ make
(... build output ...)
All of the build files (including libraries and executables that are built) will be underneath this build directory.
== Running ==
'''PLEASE NOTE that code generation is currently disabled while we finish rewriting the front end. Try rphp-analyzer instead!
Before running, setup some environment variables so rphp can find its library files. The following is a .bashrc excerpt, but what's important is to define RPHP_IR_PATH, RPHP_RUNTIME_PATH, and LD_LIBRARY_PATH if you wan to try both compiling and interpreting.
RPHP_PATH=~/rphp
RPHP_IR_PATH=$RPHP_PATH/lib
RPHP_RUNTIME_PATH=$RPHP_PATH/build/runtime/
LD_LIBRARY_PATH=$RPHP_RUNTIME_PATH:$LD_LIBRARY_PATH
export RPHP_IR_PATH RPHP_RUNTIME_PATH LD_LIBRARY_PATH
The compiler binaries will be located in the build directory in frontend/cli/.
"rphp" is the compiler and JIT interpreter. To execute a source file immediately (using JIT):
$ frontend/cli/rphp -f helloworld.php
To compile to a binary and run native:
$ frontend/cli/rphp helloworld.php
$ ./helloworld
To dump the various passes:
rphp-analyzer --dump-toks <file>
rphp-analyzer --dump-ast <file>
rphp --dump-ir <file>