Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92767 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34938 invoked from network); 26 Apr 2016 08:15:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2016 08:15:32 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.180 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.180 mail-yw0-f180.google.com Received: from [209.85.161.180] ([209.85.161.180:35700] helo=mail-yw0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D5/7A-02401-3A32F175 for ; Tue, 26 Apr 2016 04:15:31 -0400 Received: by mail-yw0-f180.google.com with SMTP id g133so6352406ywb.2 for ; Tue, 26 Apr 2016 01:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=quyAFvXU0Zfryu//PY18J+NtzLf5i3sSPTECzSYHSL0=; b=sCbWPcZiJMXosxCbCUeoPZsmX4USwoqsff67QT3yo1lMtyrKz7ZL7MH7MqW3GlPwCX u9pf121XLYG2TbZ0FMoQqjkXHZsj1WSgCFSR+7PDmd20gLP7uO1vw/f9NBfNLL+2l5GL 61IbOZmsCjGKdj339yIMN9SYHP6dy00ivukvHSHUKNlcynRyP85HqAqJXzAA4gvg6kh0 FpSnShaIyTjckANF4NwhIfIUBaVuZtawpv/kY8vhpIzEDWN9z2kyHJPbvM2fTuzdZ6yl mNiPJ3mEMgqfNJrtQNfaNdb2Na6KAyL/efxBQWfd1wsnHDe477zJQYzpXzGZsn6oeW+8 4gGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=quyAFvXU0Zfryu//PY18J+NtzLf5i3sSPTECzSYHSL0=; b=m1ihzvtHJzIIQItLh3WiMFPRBy2UbmgxkLpF31M/FKVUU0aw28vs96MsvhfebRVDkc h7J9qVSntVBCbWJyVt4f+pO2MDsol6vbE/ZYVG6C508Rn80alA/OqJU0eGcLehFYXUsQ WuIGI2RYmLYBqH5b+Nu4AcZMoprBsoiztPjGy7p4eKLFIqP3LszfSx6adoOFrozbzy19 AjaGfY31P+qHShfZvIggGH6ft3KsOk0fXA89CyoRatAOmbA0ufhASZwevTgTwQVvTEZ5 2zI+CVQctoNdR+VlaIWlj7/qAm7fIQCkIatjTvwIU0Ohz1LlB5tPHWJXOUNLBj130A2X XMsg== X-Gm-Message-State: AOPr4FVQGlG99G3DuTfdgW3TDxA2gmjYjCcDlqkMb6j+EGc/b4rynpKZTTjBQ9wr2wwyX+lipDX6md2ClgT2FQ== MIME-Version: 1.0 X-Received: by 10.129.40.147 with SMTP id o141mr551101ywo.221.1461658528729; Tue, 26 Apr 2016 01:15:28 -0700 (PDT) Received: by 10.13.239.3 with HTTP; Tue, 26 Apr 2016 01:15:28 -0700 (PDT) In-Reply-To: References: Date: Tue, 26 Apr 2016 10:15:28 +0200 Message-ID: To: Alexander Lisachenko Cc: Leigh , Sara Golemon , Nikita Popov , PHP internals list Content-Type: multipart/alternative; boundary=001a113f43dc63543d05315ee51c Subject: Re: [PHP-DEV] [RFC][Discussion] Parser extension API From: nikita.ppv@gmail.com (Nikita Popov) --001a113f43dc63543d05315ee51c Content-Type: text/plain; charset=UTF-8 On Tue, Apr 26, 2016 at 9:42 AM, Alexander Lisachenko < lisachenko.it@gmail.com> wrote: > Hello, internals! > > I'd like to bring this topic to the discussion again, because now we have > a shiny PHP7 engine and keep moving. PHP grammar becomes more complex and > internal AST representation isn't available for the userland developers, so > all static analysis tools suffering from the lack of native AST API for > that. Only possible way for that is to perform tokenization of source code > and then manually reconstruct an AST (thanks to the PHP-Parser and Nikita > for doing this job for us, developers) > > Several days ago, Dmitry published a RFC for native attributes, which can > be a great tool for building more complex stuff on top of this metadata. > However, all attribute expressions will be stored as an AST nodes, so we > need an AST API again to analyse, parse or compile AST back into the source > code for evaling, etc. > > It would be nice to push php-ast extension (or similar one) into the core, > providing an API via static class, for example "Php\Parser". > As an update here, I plan to create an RFC for bundling the php-ast extension (maybe with minor modifications) with php-src. This was planned for 7.1 anyway, and with the annotations RFC under discussion, this seems like a good time. However, I will limit this RFC to the current state of the extension, i.e. I will not include the ability to inject the AST back into the PHP compiler -- as already mentioned this is very complicated (due to validation concerns) and should be left for future scope. Some concerns like pretty printing (compiling AST back to PHP code) will also be left for userland (e.g. tpunt has a library for this), as doing this in core (on the exported AST) is unnecessarily complicated, fragile and not sufficiently flexible (e.g. with regard to formatting). I'll try to post an RFC for review this week. Regards, Nikita --001a113f43dc63543d05315ee51c--