5 ms·
This is not a snide comment, I'm truly curious. What is the point of "An [x] parser/interpreter/compiler written in [x]." I've seen one now for JS and this one
by aarondf 15y ago
This is not a snide comment, I'm truly curious. What is the point of "An [x] parser/interpreter/compiler written in [x]." I've seen one now for JS and this one for PHP. I lean more toward the sponge learning [1] side of HN, so forgive me if this is super obvious.
[1] http://alexrosen.com/blog/2011/05/sponge-learning/ http://alexrosen.com/blog/2011/05/sponge-learning/
edit: grammar.
- exim 15y agoIt doesn't necessary apply to this specific posting. But in general, as with many open source projects out there, the point is in increasing author's visibility on the net and assisting author's CV in finding a job. And there is nothing bad with this. It is just that many authors don't want to articulate on this and are trying to come up with some artificial rationales.
- mbetter 15y agoAs far as I'm concerned, "just for the hell of it" is the most noble of all rationales when it comes to stuff like this.
- EmielMols 15y agoFor instance to allow meta-programming (programming code executed at compile time) in the same language as is being interpreted/compiled. But more formally, a self-hosting compiler says stuff about the language per se, see also http://en.wikipedia.org/wiki/Bootstrapping_(compilers) http://en.wikipedia.org/wiki/Bootstrapping_(compilers).
- aarondf 15y agoThanks for the answer and the link. I'm still trying to wrap my head around the chicken/egg problem, but that may take a little while.
- Zak 15y agoa self-hosting compiler says stuff about the language per se That it's Turing-complete and can write to a file? I think all it really says is that somebody was hard-headed enough to do it.
- jacquesm 15y agoLine one in tfa: "It's purpose is to simplify static code analysis and manipulation."
- mfonda 15y agoThe benefit is that you can use it to transform PHP code into an abstract syntax tree [1]. This allows you to do some really cool things like static analysis, code transformation, preprocessing, etc. in a convenient way. The fact that it is written in PHP is nice because it allows you to use it in existing PHP projects in an environment you are already familiar with. I think the fact that it is written in PHP is less important than the fact that it can be used in PHP (e.g. it would be equally useful as a PHP extension written in C). [1] http://en.wikipedia.org/wiki/Abstract_syntax_tree http://en.wikipedia.org/wiki/Abstract_syntax_tree