forked from pbiggar/phc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ChangeLog
461 lines (410 loc) · 22.1 KB
/
ChangeLog
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
0.3.0 (7 September 2011)
------------------------
- added an optimization framework
- support basic object operations
- many many bug fixes
- added a new code generation framework, which makes it easier to use
the results of optimization and to add support for new features.
0.2.0.3 (14 February 2009)
------------------------
Bug Fix release:
* Version 0.2.0.2 was incorrectly packaged. 0.2.0.3 is what we intended to
release as 0.2.0.2. We increased the version number to show that it
differed from 0.2.0.2.
0.2.0.2 (28 January 2009)
------------------------
Bug Fix release:
* Fix bug where phc would not build if the PHP embed SAPI was not available.
* Fix bug where phc did not install files needed to compile PHP scripts.
0.2.0 (10 December 2008)
------------------------
New features:
------------------------
Code generation:
* By far the largest change is that we can now compile most PHP programs which
do not involve OO.
* Added many simple optimizations, resulting in a speedup of 1.5 or so above
PHP.
Plugins:
* The plugins are much more portable, as we now use libtool and libltdl.
Plugins are now run as pluginname.la, rather than pluginname.so.
* The plugin API has now changed. However, this allows the plugins to run
over any of the IRs.
* Plugins now install into lib/phc/plugins/.
* phc's plugins are now automatically installed.
Building phc:
* We now use PHP's embed SAPI to help resolve many questions about PHP's
behaviour. Instructions for building it are in the manual.
* phc is now built as a library by default. This makes it easier to
integrate into external projects.
* phc now uses boehm-gc garbage collector by default, and no longer leaks
(much) memory.
* phc is more portable, due to using libtool.
* Removed grep as a prerequisite.
* Require Boost, which is used quite heavily now.
* Moved to newer versions of gengetopt.
* Removed use of LD_LIBRARY_PATH, building it in instead.
* Updated to later version of automake and autoconf.
* Fix building in parallel (make -j).
Parsing:
* We now use PHP to get the values from parsed tokens, meaning we
transparently support different versions of PHP where tokens have different
meanings.
* Add a 'parse-buffer' allowing passes and plugins to create PHP code which
could be passed to the parser, rather than tediously creating the constructs
manually.
* phc now records when curly brackets are used, and unparses them correctly.
* Single quotes are now recorded, and used by the unparser.
* Comments after source are now supported, and correctly unparsed.
* Added a version of PHP's parser that spits out the parse tree in graphwiz
dot.
Unparsing:
* when unparsing, phc uses the style of the Zend coding guidelines.
* Unparse $x = &$y; as $x =& $y;
Command-line:
* Some command line options (from 0.1.7) have been renamed.
* --dump-php is now --dump=pass.
* --dump-ast-dot is now --dump-dot=pass.
* --dump-ast-xml is now --dump-xml=pass.
* --read-ast-xml is now --read-xml=pass.
* --compile-time-includes is now --include.
* Many new options were added for compiling and printing PHP files.
* --list-passes shows all the passes
Intermediate Representation:
* The names of IR constructs has changed from AST_xxx to AST::Xxx. A script
to convert old names to new names are in misc/convert_AST_names.pl.
* Removed %STDLIB% and %MAIN%, which didn't make sense. A PHP script is now a
list of statements.
* Added a High-level Intermediate representation (HIR), representing the
smallest subset of PHP which can represent the entire language.
* Added a Medium-level Intermediate representation (MIR), which uses non-PHP
constructs to simplify constructs from the HIR (say, by using gotos).
* Use maketea's fold for conversion to one IR to another. (This also allows
conversion to a non-phc IR).
* $a += $b is now represented as such, not as $a = $a + $b;
* String indices are considered identical to array indices.
* Added NOP - which is used to represent empty lines, and can have comments
associated with them (for comments that otherwise had no home.
* Use 'long' for PHP integers (which are longs internally).
* Added an is_valid() test to the IRs.
* Removed the is_array field from AST::Type. Arrays are now represented as
CLASS_NAME array.
* The IRs all inherit from IR::Node.
* Replace maketea's source_rep with a class in the AST.
* We now report a number of compile-time bugs, which PHP only catches at
run-time.
XML:
* Boolean markers now have a comment with their name added next to their
value.
* We can now nest nodes from one IR within the attributes of nodes in
another IR.
* Nodes are output using their namespace, for example AST:Variable_name.
* A number of IR changes affect how XML files appear, since they represent
the IR.
* The schema is now broken.
Documentation:
* The old documentation has be updated, rewritten in DocBook, and is separate
from the website.
* We no longer support Doxygen.
* The manual was split into the user manual and the dev manual. The latter is
for plugin writers.
Project:
* Our svn repository is now publicly available, at
http://code.google.com/p/phc/source/checkout.
* The phc-internals mailing list is now publicly available.
* We have moved our project to http://code.google.com/p/phc.
* We have removed our STATUS file, and now use the Google Code issue
tracker at http://code.google.com/p/phc/issues/list.
* Maketea is now a project of its own, available at http://maketea.org.
* The svn repository now uses traditional {trunk branches tags} roots.
Testing:
* Added more than 400 tests scripts to the test suite.
* Greatly expanded tests, and testing framework. Each revision is now
tested and benchmarked.
* We have removed regression tests, viewing them as more trouble than they
are worth.
* We now test the unparser and the IRs every few passes.
* Added WhiteSpace test, checking that our unparsing is the same as the
input (exception whitespace). We're doing pretty well.
* We unparse after removing all the annotations of the user source.
* We test compiled code, compiled-optimized code, refcounts of the compiled
code, and the same code with every second statement eval'ed.
* Multiple tests now run in parallel, making the overall test run much faster.
* Support individual tests of a feature, using 'annotated tests' (adding
DejaGnu style comments to control options and expected output).
* Test DOT output using 'gc' from dotty.
* make check now runs tests.
Miscellaneous:
* Added a pass_manager. --disable=passname will allow the user to disable a
pass. -v shows the passes being run.
* Add a 'reduce' tool for reducing test cases by progressively removing
statements until the test no longer fails.
* The directory structure has changed, which most code going into the src/
directory.
Bug fixes
------------------------
Parsing:
* The lexer didn't escape backslashes.
* Properly escape backticked strings.
* The value of __METHOD__ incorrectly did not contain the classname.
* Fix short-circuiting bug.
* Fixed a number of miscellaneous bugs.
Unparsing changes:
* Interpolated strings (or in-string-syntax) is now unparsed correctly.
* Unparse $x{-1} correctly.
* Fixed minor DOT unparsing bug.
Building phc:
* Fix building in parallel (make -j).
Miscellaneous:
* Many many bug changes which do not get a mention here.
0.1.7 (8 September 2006)
------------------------
Since no major problems were reported in 0.1.7rc2, released 0.1.7. Note that
some line numbers are still incorrect, so that the line number regression test
will still fail.
0.1.7rc2 (21 July 2006)
----------------------
Minor bugfixes:
* Bug in Process_ast that should have caused the whole thing to fail but for
some reason didn't
* The schema wasn't regenerated properly when phc.tea was modified
* "+=" style expressions were unparsed incorrectly in some cases; phc now
automatically brackets the second expression, so that $x += $y is unparsed
as $x = $x + ($y)
0.1.7rc1 (13 July 2006)
-----------------------
* Added support for plugins. phc extensions no longer need to be hardcoded
into the phc binary, but can be compiled completely independent of the phc
binary (a shellscript phc_compile_plugin makes compilation of plugins easy).
This makes binary packages of phc much more useful
* Documentation updated to explain writing plugins
* Added a new tutorial to explain how to remove nodes from the tree or
replacing nodes by multiple new nodes (tutorial 6).
* All the plugins that are developed in the tutorials now come standard
as plugins with phc (plugins/tutorials/*); also added a few new plugins
to demonstrate certain features (for example, traversal order)
* To make installing phc useful, "make install" now installs the phc binary,
the aforementioned script, all the headers that are necessary to compile
plugins (by default into /usr/local/include/phc). In addition, a number
of default plugins are installed, as is the XML schema.
* All selfs tests are removed from the binary (command line options are gone,
too) and are now implemented as plugins
* Minor feature enhancements/bug fixes:
- compile_time_includes now sets targets on AST_variable properly
(this cannot be seen from the PHP output, but will be apparent from
the XML output or DOT output)
- XML AST's can now be read from standard input
- XML AST's must be read using the --read-ast-xml command line option
- Comments, line numbers, and other AST attributes are now serialised
and deserialised from and to XML
- Removed the schema location from the generated XML files
(this is set by the phc binary instead)
- Added a page to the website with information for package maintainers
Also made the tests available from the website (approx 20 MB)
- AST nodes now have a phc.filename property (which specifies the file
the node was defined in)
- Removed class attributes from the AST nodes; these are now entries in
attrs; some entries are removed altogether once they are no longer
necessary (parser temporaries)
- Global variables are now static attributes of %MAIN% (as they should be
and were documented to be)
- Integers specified in hex (0x..) larger than MAX_INT were incorrectly
converted to doubles on systems where atof does not support hex (ISO
dictates it should, but it does not on Cygwin/Solaris/perhaps others)
0.1.6rc2 (7 July 2006)
---------------------
* Bugfix: Scripts with open ended PHP (no closing tag) had an extraneous echo
at the end; also, use of identifiers as array indices inside strings caused
the identifier to be duplicated in the string to follow the variable access.
0.1.6rc1 (4 July 2006)
----------------------
* The build process now uses autoconf and automake. From a user's perspective,
this means that compiling phc now takes two steps: running ./configure,
followed by running make. For people using phc to develop applications, the
use of automake means that we now have automatic dependency tracking, which
is quite nice (esp. because the dependencies that were specified manually
in the old Makefile were often not completely up to date).
The distribution tarball will contain all generated code, so that users
only need a C++ compiler and make tool to build phc.
* The Tree_transform API has been split into two APIs: the (original)
Tree_transform API and a (new) Tree_visitor API. Tree_transforms can modify
the structure of the tree, as before. There are a few differences with the
old API:
- The signatures of methods is different (they have a return type instead of
a second "out" parameter using a double pointer).
- If a pre_transform returns a new node, that node does not (automatically)
get recursively transformed (although if necessary the user can this
request this behaviour by manually calling pre_transform on the new node).
- Some transforms can now return lists; for example, all statements can
return lists. This makes it possible to replace a single if-statement
(say) in the tree by multiple other statements, or indeed by an empty list
of statements, effectively deleting the statement from the tree.
The Tree_visitor API can be used to define "visitors" over the tree; a
visitor cannot modify the structure of the tree, but on the positive side,
visitors can be defined generically: for example, it is possible to define a
visitor that visits every node by implementing the "pre_node" method. For
details see the tutorials on the phc website.
* The AST classes now support "deep_equals" and "match" methods. "deep_equals"
implements deep equality; "match" is nearly the same as deep equality, but
only takes the tree itself into account (and ignores for example comments
and line numbers), and supports wildcards ("WILDCARD"). This is useful
for pattern matching in tree transforms and visitors. See tutorials on the
phc website for details.
* The AST class hierarchy, Tree_transform API and Tree_visitor API are now
generated (rather than written manually) by a new tool called "maketea".
* Instead of using Vector<AST_statement*> for a list of statements, we generate
specialised list classes for each type (.e.g, AST_statement_list). These
specialised list classes are proper AST nodes, and thus have their own
transform and visit methods (note that these classes inherit from the STL
list class, and can be treated as such).
* Simplified the grammar; we no longer have "refable_expr" or "expr_opt_ref";
instead, we only have "expr"s (expressions), and references are indicated
explicitely (where they are allowed). The rule for assignment has changed;
an assignment can now only have a variable or a list of variables on the left
hand side. Further, static_var now only allows a single variable, which
removes the need for a separate "static_declaration" and "static_var";
removed production for "static_var".
* The DOT unparser and PHP unparser are now implemented as Tree_visitors; this
means that it is easier to define new unparsers, by inheriting from these
parsers and redefine the appropriate methods. The PHP unparser checks the
"--tab" command line option to specify the string to use for indentation
(defaults to a single TAB).
* Added an XML unparser that dumps the AST into XML format.
In addition, we added an XML parser that is able to read back in the output
of the XML unparser (needs Xerces) - of course, we can then dump the XML back
to PHP syntax. This is useful for people that want to write applications to
operate on PHP scripts based on our abstract representation, but do not want
to use phc itself.
The schema for the XML can be found at http://www.phpcompiler.org/phc-1.0.
* We no longer bundle the Boehm garbage collector. Linking in the garbage
collector leads to segfaults in some cases, which we suspect is due to
a bug in the garbage collector. However, ./configure has an option to
enable the garbage collector (--enable-gc), which must be installed on the
host system.
* We now support a "--compile-time-includes" flag that enables compile time
includes (see "Running phc" on the website for details).
* Various minor bugfixes and features:
- HEREDOC terminating on XXX, that contained lines starting with XXX,
was parsed incorrectly
- Added support for "<>" operator
- Removed support for nested multiline comments (we figured supporting
nested comments would be backwards compatible, but of course it isn't)
- Class attributes can now have names that are keywords
(PHP allows this which is why we now allow it; though why anyone would
want to do this I don't know)
- "elseif" clauses are now marked as being an "elseif" clause by the parser
(AST_if::elseif) and are unparsed correctly by the unparser
- Literal values (integers, reals, etc.) are now unparsed exactly as they
are specified in the script (i.e., "False" unparses as "False", "null"
unparses as "null", etc. - previously they values were unparsed in a
"canonical" way - for example, always "NULL")
- Unary minus (-5) is now regarded as a single integer (-5), rather than
an operation (-) on an integer (5); which makes it possible to deal with
LONG_MIN (-2^31) correctly
- Integers outside the integer range are treated as reals
- Transforms and clone methods now use covariant return types. This makes
the code more readable, removes the need for dynamic casts in many
places, but does require a recent version of gcc (3.4.0+)
- A comment before the definition of an interface is now associated with
the interface itself, rather than with the first definition in the
interface.
- Scripts that ended on a comment, and did not include a closing tag "?>",
had an extraneous "echo" at the end of the script.
0.1.5.1 (27 January 2006)
-------------------------
Patch to make phc compile on systems with old versions of Flex.
0.1.5 (26 January 2006)
-----------------------
This is mainly a clean-up release. Lots of minor improvements and bug fixes. The
most important improvements ones are mentioned below.
* Changed the license from GPL to BSD. Detailed licensing information can be
found in the directory "license".
* Made the parser re-entrant (removed all globals). This is the first step
towards an implementation of "include". However, this feature is still
EXPERIMENTAL.
* Added automated testing (both regression tests and unit tests). "make test"
will run all test and show how many passed/failed. To get verbose output, run
"make verbose-test" instead. You will need PHP5 to run the tests. Made a few
minor changes to the code to make regression tests possible.
* Changed the build process; source files generated by tools (flex, bison,
gperf or gengetopt) are now create in the directory "generated/". All of these
files are included in the release tarballs, so that users will only need gcc
to compile phc (and don't need flex, bison, gperf or gengetopt). Also, object
files are created in the directory "build/", to avoid cluttering up the root
directory.
* Added a new make target "phc-nogc" which will build a version of phc with no
garbage collector built-in. Make sure to run "make cleanall" before switching
from "make phc" to "make phc-nogc" and back.
* Minor modification to the grammar: arguments to static local variable
declarations in methods are optional.
* Modified the DOT unparser to give slightly better readable output
(distinguishes booleans from Tokens graphically and optionally inserts line
numbers if the option --use-line-numbers is passed to phc)
* Upgraded the garbage collector to version 6.6.
This release incorporates the following bug fixes:
* Unary plus (e.g, +$x) caused the parser to crash.
* Due to an uninitialised (private) variable in AST_variable, variables were
sometimes recognised as method invocations instead (sometimes this crashed the
parser, too).
* Calls to "echo" now generate calls to "echo", rather than "print". Moreover,
extraneous brackets in the arguments to echo (and similar built-ins) are
avoided.
* Class attributes were not given a dollar sign by the PHP unparser.
* The PHP unparser wasn't unparsing complex function names correctly (function
names that are actually expressions).
* Throw statements were not terminated by a semi-colon by the unparser.
* Sometimes reference assignments were recognised as "global" statements.
* \" in HEREDOC strings should be interpreted as two characters, rather than
just one (") - i.e., " does not need to be escaped in HEREDOC strings.
* HEREDOC strings were not dealt with in a binary safe way.
* Windows style newlines were still not handled perfectly (especially at the end
of a script).
* The generated syntax tree was not strictly linear (some nodes in the tree were
"shared" by multiple parent nodes).
* Older versions of Bison wrote their output to the wrong directory; the output
of bison is now explicitly specified.
0.1.4 (9 January 2006)
----------------------
* "global" declarations are no longer explicitly represented in the tree. See
"Converting PHP" for a detailed explanation of how they are now represented.
* Added deep_clone methods to all classes in the Object hierarchy.
* Bug fix: __METHOD__ crashed the parser
* Bug fix: Line numbers weren't counted properly
* Replaced the single SCALAR terminal symbol in the grammar by five separate
terminal symbols (INT, REAL, STRING, BOOL, and NULL). Updated the class
hierarchy, tree transform API, parser and unparser and documentation to
reflect this change. Note that the structure of all Token_xxx classes have
changed; they no longer inherit from String, but have an attribute called
"value" instead, which will be of type String for most (but not all) tokens.
Refer to the grammar formalism (or ast.h) for details.
* Removed the transform_children methods for the token symbols from the tree
transform class (tokens do not have children).
* Modified the tree transform API so that if a pre transform returns a new
node, phc will call the pre transform _again_ on that new node. This is
detailed in the completely rewritten tutorial 3.
* Renamed FUNCTION_NAME to METHOD_NAME and function_call to method_invocation
to bring the terminology in line with the rest of phc.
* Updated "Converting PHP" so that it explains variable and function targets.
Also, the explanation of variables in the old tutorial 3 has been moved here.
* Documented the _implementation_ of the tree transform API. Also wrote an
article "Memory layout for Multiple and Virtual Inheritance" to provide some
background information.
0.1.3 (1 December 2005)
-----------------------
Fixed a few bugs:
* Null vectors are now unparsed properly by the dot unparser
* RETURN and RETURN_OP in the lexer were broken (i.e, --dump-tokens wasn't
working) - they were referring to source column numbers that we no longer keep
track off.
* We now deal with Windows-style line-breaks.
0.1.2 (17 November 2005)
------------------------
Added functionality to the TreeTransform API to enable the programmer to change
the order in which the children of a node are visited, avoid visiting some
children, or execute a piece of code in between visiting two children.
0.1.1 (2 November 2005)
-----------------------
Fixed a bug in the lexer (PHP in-string syntax).
0.1 (29 September 2005)
-----------------------
First release.