Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62844 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82095 invoked from network); 6 Sep 2012 07:27:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Sep 2012 07:27:29 -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:54072] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 51/63-01139-E5058405 for ; Thu, 06 Sep 2012 03:27:27 -0400 Received: from Hwhost2.local (162-95.79-83.cust.bluewin.ch [83.79.95.162]) by host1.trois-doubles.net (Postfix) with ESMTPA id 9560E209594 for ; Thu, 6 Sep 2012 09:27:23 +0200 (CEST) Message-ID: <5048505D.8060004@hoa-project.net> Date: Thu, 06 Sep 2012 09:27:25 +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: <50474A30.1090802@nznet.gen.nz> <504784F7.5030801@ajf.me> In-Reply-To: <504784F7.5030801@ajf.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Moving to an AST-based parsing/compilation process From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 05/09/12 18:59, Andrew Faulds wrote: > On 05/09/12 13:48, Morgan L. Owens wrote: >> I'm not a core dev, but I would like to add to the notes above that >> "third parties", such as myself, who want to do things with PHP >> source other than run it through a PHP interpreter would also >> appreciate such a separation of concerns. >> >> To date, I've been basing work, which exposes syntactic structure, on >> phc's maketea grammar (Phalanger's is more up to date, but also more >> complicated what with its provenance and the Linq and generics and >> all), but it's reverse-engineered and certainly wrong (oh, that >> reminds me...); the existing grammar is unsuitable because no-one >> wants to see _that_. >> >> Something authoritative that _by definition_ tracks the current >> version would be more reassuring as regards accuracy and >> compatibility (and be more likely to result in something that >> deserves to be let out into the world with confidence). >> >> > To add to your point: > > If we make it produce an AST, I wonder if we could possibly expose > this through PHP, perhaps with some sort of extension. Then parsers > and such for PHP could simply ask PHP to do the parsing for them, and > then do analysis - no more duplicating official PHP grammar. > > I'm just speculating here, but this would be pretty cool if we could > do it. +1. It will be very useful for static analysis, test, control flow graph etc. -- 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/