Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62831 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89524 invoked from network); 5 Sep 2012 08:05:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2012 08:05:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:53046] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/1E-12568-ED707405 for ; Wed, 05 Sep 2012 04:05:50 -0400 Received: from Hwhost2.local (252-90.78-83.cust.bluewin.ch [83.78.90.252]) by host1.trois-doubles.net (Postfix) with ESMTPA id 3151920933C for ; Wed, 5 Sep 2012 10:05:47 +0200 (CEST) Message-ID: <504707D9.2010303@hoa-project.net> Date: Wed, 05 Sep 2012 10:05:45 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0a2 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Moving to an AST-based parsing/compilation process From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") Hi, On 04/09/12 21:57, Nikita Popov wrote: > Hey folks! > > Some people asked me what the advantages of using an AST-based > parsing/compilation process are, so I put together a few quick notes > in an RFC: > > https://wiki.php.net/rfc/ast_based_parsing_compilation_process > > It would be nice to get a few comments from other core devs on this. From my personal point of view, I see more advantages than inconvenients of using an AST. It is a more consistent and clever way to manipulate a language. We can have more optimizations processes, algorithms and heuristics. We have already spoken about consistency in the PHP syntax, but it will also be easier for contributors to suggest new patches in regards to the syntax and syntactic-sugar. An AST will also facilitate opcode caching (even a trivial approach at first would be promising I think), and again, it will egg on contributors to propose new patches for that. Moreover, there are a lot of well-known algorithms and heuristics in the literature to compensate for memory overhead. I think about lazy-compilation to avoid the build of the whole AST. Even if the first feeling is that AST appears to bring some issues at first, it could be very quickly a benefit for PHP, in terms of consistency in the code, performance and memory usage. Conversely, it requires a lot of work. I can help if needed. Cheers. -- Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/