Live data from Hacker News

Php-parser written in golang v0.3 is released

github.com

1–10 of 28 posts

Re: Php-parser written in golang v0.3 is released

#3
There's a [dead] comment that asks "Why?"...

Obviously not every project needs a "why?", and this is a technically cool endeavour that stands on its own..

A few ideas I can think of for "Why?":

    * Static analysis of a codebase looking for bad practices or errors
    * Feeding the structured output into code-gen for another language, to start a porting project
    * //STEP MISSING//, Profit? 
Anything else?

Re: Php-parser written in golang v0.3 is released

#4
post #3

There's a [dead] comment that asks "Why?"... Obviously not every project needs a "why?", and this is a technically cool endeavour that stands on its own.. A few ideas I can think of for "Why?": * Static analysis of a codebase looking for bad practices or errors * Feeding the structured output into code-gen for another language, to start a porting project * //STEP MISSING//, Profit? Anything else?

As much as my first reaction was also "why?" writing a complex parser is a good exercise, and of course having a suitable parser is a pre-requisite for all kinds of tooling, be it analysis tools, or writing an alternative implementation of the language itself.

Re: Php-parser written in golang v0.3 is released

#5
What is the purpose of this? Just static analysis?

If that is it, you'd probably be better off just using the PHP parser (https://github.com/nikic/PHP-Parser).

If you are writing analyzers for PHP, you must know it enough to right an analyzer in actual PHP. Why Go?

I can't see a lot of people using this.

Re: Php-parser written in golang v0.3 is released

#6
post #3

There's a [dead] comment that asks "Why?"... Obviously not every project needs a "why?", and this is a technically cool endeavour that stands on its own.. A few ideas I can think of for "Why?": * Static analysis of a codebase looking for bad practices or errors * Feeding the structured output into code-gen for another language, to start a porting project * //STEP MISSING//, Profit? Anything else?

Aaron Patterson, the author of phuby (https://github.com/tenderlove/phuby) once explained in a talk what's good about embedding a php interpreter in ruby. The gist, as I remember was: Technically speaking, it makes no sense. It will never become anything useful. But you can make it work, and you might learn something useful along the way. IIRC, he found a couple of very interesting (and useful) issues along the way.

So the answer might just be "because I can and I want to".

This is the talk, IIRC: "Yak shaving is best shaving" https://www.youtube.com/watch?v=nY_Pl2x7Fgs

Re: Php-parser written in golang v0.3 is released

#7
post #5

What is the purpose of this? Just static analysis? If that is it, you'd probably be better off just using the PHP parser ( https://github.com/nikic/PHP-Parser ). If you are writing analyzers for PHP, you must know it enough to right an analyzer in actual PHP. Why Go? I can't see a lot of people using this.

This project states that it was "inspired by" Nikita's parser, but to me that raises even more questions about its existence.

nikic/PHP-Parser is feature-complete/mature/stable and developed by one of the most knowledgeable members of the PHP internals core development team. It is the library powering many PHP dev tools; static analysis included.

I can see that creating a tool like this is an excellent learning experience, but I don't see why anyone else should care.

Re: Php-parser written in golang v0.3 is released

#9
post #6
post #3

There's a [dead] comment that asks "Why?"... Obviously not every project needs a "why?", and this is a technically cool endeavour that stands on its own.. A few ideas I can think of for "Why?": * Static analysis of a codebase looking for bad practices or errors * Feeding the structured output into code-gen for another language, to start a porting project * //STEP MISSING//, Profit? Anything else?

Aaron Patterson, the author of phuby ( https://github.com/tenderlove/phuby ) once explained in a talk what's good about embedding a php interpreter in ruby. The gist, as I remember was: Technically speaking, it makes no sense. It will never become anything useful. But you can make it work, and you might learn something useful along the way. IIRC, he found a couple of very interesting (and useful) issues along the way…

Embedding an interpreter in another language can certainly be useful, but this is just a parser.

Re: Php-parser written in golang v0.3 is released

#10
post #9
post #6

Earlier quoted context omitted.

Aaron Patterson, the author of phuby ( https://github.com/tenderlove/phuby ) once explained in a talk what's good about embedding a php interpreter in ruby. The gist, as I remember was: Technically speaking, it makes no sense. It will never become anything useful. But you can make it work, and you might learn something useful along the way. IIRC, he found a couple of very interesting (and useful) issues along the way…

Embedding an interpreter in another language can certainly be useful, but this is just a parser.

Sorry, but phuby is not useful, was never intended to be and even says so. It's a hilarious prank, if you ask me.
Post reply on HN