PHP Compiler Internals

Sebastian Bergmann » 27 May 2009 » in PHP » 0 Comments

Defined tags for this entry: , ,

Speaking at Dutch PHP Conference 2009

Sebastian Bergmann » 09 April 2009 » in Events » 3 Comments

I will present the following session at this year's Dutch PHP Conference:

PHP Compiler Internals

In this presentation we introduce a new language construct to demonstrate how one might go about modifying the PHP interpreter. The internals of which follow a pattern common to many language implementations, with lexical analysis, parsing, code generation, and execution phases.

By the end of the presentation, it is hoped the audience will see that contributing to the PHP language core is not necessarily as difficult as it might seem.

The idea for this presentation came to me at last year's Open Source Developers Conference (OSDC) in Sydney where Thomas Lee gave a presentation titled "Python Compiler Internals". In this presentation, Thomas not only explained how Python's compiler works, but also how to extend it.

In my presentation at the Dutch PHP Conference I want to do the same, only for PHP. While Sara's "Extending and Embedding PHP" is the reference work on extending PHP through extensions, it does not cover the PHP interpreter's compiler phase. With this presentation I hope to provide at least a starting point for interested developers that are looking to extend PHP's compiler.

Defined tags for this entry: , , ,

Speaking at IPC Spring 2009

Sebastian Bergmann » 27 February 2009 » in Events, Presentations » 2 Comments

I will present two sessions at this year's International PHP Conference - Spring Edition:

Cool PHP Objects Sleep on the Couch

Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database that provides scalability as a consequence of its design. Due to its RESTful JSON API, talking to CouchDB from PHP is fairly easy, bindings such as PHPillow make this communication even easier.

The PHP Object Freezer provides the low-level functionality to store (“freeze”) and retrieve (“thaw”) any PHP userland object to and from arbitrary object stores. CouchDB is a natural fit for such an object store.

This presentation shows how PHP’s Reflection API can be used to customize the serialization of PHP objects and provides a pragmatic introduction to Apache CouchDB.

PHP Compiler Internals

In this presentation we introduce a new language construct to demonstrate how one might go about modifying the PHP interpreter. The internals of which follow a pattern common to many language implementations, with lexical analysis, parsing, code generation, and execution phases.

By the end of the presentation, it is hoped the audience will see that contributing to the PHP language core is not necessarily as difficult as it might seem.

See you in Berlin in May!

Defined tags for this entry: , , ,

Greg Beaver is my Hero

Sebastian Bergmann » 17 June 2006 » in PHP » 2 Comments

Greg Beaver has ported the LEMON Parser Generator to PHP.

This finally gives the PHP Community an LALR(1) parser generator that takes a context free grammar and converts it into a PHP subroutine that will parse a file using that grammar.

Greg's work brings one of my dreams closer to reality: a framework that reads PHP sourcecode into an abstract syntax tree, allows transformations of that tree from within PHP code, and serializes the abstract syntax tree back to PHP sourcecode.

Update: Greg now did the same for a lexer generator (using a syntax similar to re2c).