News for hackers. Stuff that matters.
Re:Php-parser written in golang v0.3 is released by andrewstuart2 on Friday March 02, 2018 @12:15PM (#16503505)
With a properly parsed AST, you could probably convert to Go's AST and compile down to the final Go binary, similarly to how you can write a new front-end for LLVM.
Re:Php-parser written in golang v0.3 is released by zbentley on Friday March 02, 2018 @12:34PM (#16503725)
Theoretically, you almost could (with quite a bit of difficulty), but then there's the problem of "eval".

You can "solve" that by embedding an interpreter (or a copy of your compiler) into your runtime, but most interpreted platforms in that situation consider the interpreter "good enough" and work on making optimizations (e.g. JIT compilation to native code) on it rather than making a static compiler.

Re:Php-parser written in golang v0.3 is released by toast0 on Friday March 02, 2018 @11:49PM (#16507933)
I mean, eval is a thing, and I'm sure people use it, but I don't recall using it much while a PHP developer. It's just more likely to footgun than anything else. I think you can credibly release a tool that will compile PHP into a standalone executable, as long as it doesn't call eval.