Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62839 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43752 invoked from network); 5 Sep 2012 17:00:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2012 17:00:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 64.22.89.133 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 64.22.89.133 oxmail.registrar-servers.com Received: from [64.22.89.133] ([64.22.89.133:48453] helo=oxmail.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/38-12568-02587405 for ; Wed, 05 Sep 2012 13:00:18 -0400 Received: from [192.168.0.200] (5ad3285b.bb.sky.com [90.211.40.91]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id AD667758189; Wed, 5 Sep 2012 13:00:13 -0400 (EDT) Message-ID: <504784F7.5030801@ajf.me> Date: Wed, 05 Sep 2012 17:59:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: "Morgan L. Owens" CC: PHP internals References: <50474A30.1090802@nznet.gen.nz> In-Reply-To: <50474A30.1090802@nznet.gen.nz> 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: ajf@ajf.me (Andrew Faulds) 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. -- Andrew Faulds http://ajf.me/