Re: [PHP-DEV] generating code from AST

2017-03-08 Thread Nikita Nefedov
> On 8 Mar 2017, at 08:49, Sebastian Bergmann wrote: > > Am 07.03.2017 um 11:33 schrieb Derick Rethans: >> Because installing an extension is too hard? > > No. To ensure that userland functionality that is based on compiler > internals (token stream, abstract syntax tree,

Re: [PHP-DEV] generating code from AST

2017-03-08 Thread Sebastian Bergmann
Am 07.03.2017 um 11:33 schrieb Derick Rethans: > Because installing an extension is too hard? No. To ensure that userland functionality that is based on compiler internals (token stream, abstract syntax tree, bytecode) does not fall out of sync with the compiler. We already have an extension

Re: [PHP-DEV] generating code from AST

2017-03-07 Thread Rowan Collins
On 07/03/2017 10:33, Derick Rethans wrote: Having a bytecode disassembler in core would also be nice, yes. Because installing an extension is too hard? It sounds like reinventing the wheel. Not necessarily reinventing it, just pre-attaching it to the carriage ;) By which I mean, there's no

Re: [PHP-DEV] generating code from AST

2017-03-07 Thread Derick Rethans
On Tue, 7 Mar 2017, Sebastian Bergmann wrote: > Am 07.03.2017 um 07:01 schrieb David Walker: > > > When/if there are changes to AST, having a tool like these in core > > would require them to be updated at the same time. > > Exactly. > > > Would this concept also want to extend to a VLD-esque

Re: [PHP-DEV] generating code from AST

2017-03-06 Thread Sebastian Bergmann
Am 07.03.2017 um 07:01 schrieb David Walker: > When/if there are changes to AST, having a tool like these in core would > require them to be updated at the same time. Exactly. > Would this concept also want to extend to a VLD-esque extension as well for > the same reasons? I'd be receptive for

Re: [PHP-DEV] generating code from AST

2017-03-06 Thread David Walker
On Mon, Mar 6, 2017 at 22:55 Sebastian Bergmann wrote: > Am 06.03.2017 um 22:40 schrieb Sara Golemon: > > https://github.com/sgolemon/astkit > > There's also https://github.com/nikic/php-ast. > > But wouldn't it be great if PHP 7.2 shipped with a built-in, > enabled-by-default

Re: [PHP-DEV] generating code from AST

2017-03-06 Thread Sebastian Bergmann
Am 06.03.2017 um 22:40 schrieb Sara Golemon: > https://github.com/sgolemon/astkit There's also https://github.com/nikic/php-ast. But wouldn't it be great if PHP 7.2 shipped with a built-in, enabled-by-default extension for AST operations? -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] generating code from AST

2017-03-06 Thread Sara Golemon
On Mon, Mar 6, 2017 at 3:40 PM, Sara Golemon wrote: > On Mon, Mar 6, 2017 at 3:37 PM, Adam Baratz wrote: >> I'm exploring how to automate some basic kinds of refactor operations. One >> approach I'm considering: >> >>- Generate an AST >>- Rearrange it

Re: [PHP-DEV] generating code from AST

2017-03-06 Thread Sara Golemon
On Mon, Mar 6, 2017 at 3:37 PM, Adam Baratz 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

[PHP-DEV] generating code from AST

2017-03-06 Thread Adam Baratz
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? Thanks, Adam