Re: generating code from AST
| From: | Sara Golemon | Date: | Mon, 06 Mar 2017 21:40:45 +0000 |
| Subject: | Re: generating code from AST | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98412@lists.php.net to get a copy of this message | ||
On Mon, Mar 6, 2017 at 3:37 PM, Adam Baratz <adambaratz@php.net> wrote:
> I'm exploring how to automate some basic kinds of refactor operations. One
> approach I'm considering:
>
> - Generate an AST
> - Rearrange it as needed
> - Turn it back into userland code
>
> Is this something anyone's explored?
>
The engine's internals actually have an ast export method which does
this alread (it's used by the assert message generator). astkit
makes use of this in an extension to do much of what you describe:
https://github.com/sgolemon/astkit
-Sara