3 ms·
I worked on a PHP compiler: http://phpcompiler.org http://phpcompiler.org. Although it only supports PHP 5.2, it has a really nice parser, which had a lot of wo
by pbiggar 12y ago
I worked on a PHP compiler: http://phpcompiler.org http://phpcompiler.org. Although it only supports PHP 5.2, it has a really nice parser, which had a lot of work put into it (a ton of edge cases in particular).
It's not in Go, but it does a lot of the interesting things you asked about: static analysis, dead code elimination, transpiling. It also compiles to (pretty poor) C code.
For static analysis, there's a lot to do. Here's my PhD on the topic: http://paulbiggar.com/research/#phd-dissertation http://paulbiggar.com/research/#phd-dissertation
I worked on this for about 4 years, and if my experience is indicative of working on PHP compilers is general, you have a lot of fun, and a massive amount of frustration in front of you.
- girvo 12y agoSince scrutinizer-ci took their interesting "PHP-analyser" private I've been looking for a better static analysis tool for PHP that I can contribute to. HPHPc is alright in HHVM but learning OCaml is slowing me down, so I'm definitely going to take a look at your compiler! Well done :)