4 ms·
While I'm cool with writing other language processors in a new language (Lisp written in Cobol anyone?) I'm missing the value of this past the bragging rights.
by AstroJetson 8y ago
While I'm cool with writing other language processors in a new language (Lisp written in Cobol anyone?) I'm missing the value of this past the bragging rights.
There was a similar article about writing the LuaVM in Go, to package it in bigger Go applications. I've done lots of C based systems and bolted Lua on, so the Go version makes sense.
But is imbedding Awk into a program that gets done on a regular basis?
- f2f 8y agoThe performance optimization part of the article is very relevant to experienced Go programmers. Also, pjw, the W in AWK is on the Go team at Google and Kernighan, the K, wrote the canonical Go book.
- bitofhope 8y agoAnd Aho, the A co-wrote the most famous book on compilers. I like to think he'd approve of implementing programming languages.
- 101km 8y agoI believe in this instance it is the author wanting to level up on AWK and Go. The value is learning and fun. An AWK interpreter written in Go is unlikely to be an improvement, except, well here is another blog post you might be interested in that has a similar sense of adventurous tinkering (it's about improving on grep): https://ridiculousfish.com/blog/posts/old-age-and-treachery.html https://ridiculousfish.com/blog/posts/old-age-and-treachery.... That's from 2006 and the tl;dr was graybeards did things a certain way for a reason. And yet nowadays with have things like rg (and ag and a bunch of others).
- bhengaij 8y agoI think my GP has an objection to it being shared and being on top when there is nothing to learn from this in terms of ideas (which I share) and not to people hacking away.
- Insanity 8y agoBut now other people who are interested in Go can learn from it. Seems pretty much the point of HN - finding interesting things to learn.
- cicero 8y agoI look forward to reading this article when I have the time because I am a Go newbie, so a well explained example program will be useful to me. Also, I find language implementation interesting, and I've always admired the AWK language. I for one and glad he did it and wrote an article explaining it. Finally, I think it is good to see C software being rewritten in more robust languages like Go and Rust, if people are inclined to do so. I don't think rewriting all the C software should be our top priority, especially high-quality programs like AWK, but it's a good overall direction to go when people are interested.
- bsg75 8y agoThis might be an avenue for programmers who are comfortable in Go but not C to extend a version of the Awk language. For example I have wished for a long time that Gawk could parse gzipped files so that filenames could be used directly. I could take a run at implementing that in this interpreter where the C version would be more difficult personally.
- t-3 8y agoIs there a reason you can't just use a pipe and process stdin?
- deleted 8y ago[deleted]
- bsg75 8y agoThat is what I do today. However in the case where metadata is part of the file name, the FILENAME variable is not populated without something else in the pipeline that passes it into the Awk script as a variable.