Golang Parser Written in PHP 8.1
Hi everyone!
I wanted to play with hot new PHP features, but am hardstuck with 7.4 version on current job, so it made me decide to create a small project to test waters with new features.
So here it is, it is a hand written parser with zero dependencies, which translates Golang code to an AST, written in PHP 8.1.
https://github.com/tuqqu/go-parser
Feel free to provide feedback!
Posted Feb 5, 2022, 12:40 PM UTC · edited
What was the most useful PHP 8.1 feature that helped you to build the parser?
I loved all of them, but the most useful were
Enumspaired withmatchexpression, definitely. A very very useful combo.[deleted]
matchis nice, but cannot substituteswitchcompletely (yet at least).It is limited to a single expression only, hence we still need to use
switchin cases where we have more than one statement to execute.