Re: generating code from AST
| From: | Sara Golemon | Date: | Mon, 06 Mar 2017 21:42:43 +0000 |
| Subject: | Re: generating code from AST | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98413@lists.php.net to get a copy of this message | ||
On Mon, Mar 6, 2017 at 3:40 PM, Sara Golemon <pollita@php.net> wrote:
> 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
>
Hrmmm, I seem to have not updated the README.md, but it is in there:
https://github.com/sgolemon/astkit/blob/master/astkit-node.c#L204-L214
-Sara