z7zmey / php-parser

PHP parser written in Go
https://php-parser.com
MIT License
941 stars 63 forks source link

Question: nikic / PHP-Parser AST compatibility #104

Open oscarnevarezleal opened 4 years ago

oscarnevarezleal commented 4 years ago

Does the AST data structure generated by this project share similarity with its counterpart on the PHP language ( nikic/PHP-Parser ) ?

I'm trying to parse as a significant amount of files and z7zmey/php-parser would be a deal-breaker for its speed, the problem is that I have several features depending on nikic/PHP-Parser mainly because of its AST Builder.

If I could share the same AST interoperability would be perfect.

sohaha commented 4 years ago

Same needs, looking forward to follow-up support

z7zmey commented 3 years ago

hi @oscarnevarezleal and @sohaha. At 0.8 I have changed the AST structure back to be as same as possible as nikic/php-parser

Do you have any idea how AST could be transferred from Golang to PHP? I think about dumping to PHP deserializable string.

oscarnevarezleal commented 3 years ago

Hey, @z7zmey I'll take a look at it this week.

Regarding your question, nikic/PHP-Parser contains some utilities to convert an AST into JSON and back, I'd dig into that.