TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

GoAWK: an AWK interpreter written in Go

228 点作者 f2f超过 6 年前

12 条评论

kris-s超过 6 年前
AWK is such a cool little tool, great way to process log files (as shown in the article). Glad to see it still getting some attention.<p>It&#x27;s kinda nuts how far the unixy idea of &quot;just streams of text&quot; has gotten us.
评论 #18479046 未加载
kazinator超过 6 年前
Awk in Lisp as a macro with Lisp AST syntax:<p><a href="http:&#x2F;&#x2F;nongnu.org&#x2F;txr&#x2F;txr-manpage.html#N-000264BC" rel="nofollow">http:&#x2F;&#x2F;nongnu.org&#x2F;txr&#x2F;txr-manpage.html#N-000264BC</a><p>* Implements almost all salient POSIX features and some Gawk extensions.<p>* <i>awk</i> expression can be used anywhere an expression is allowed, including nested within another <i>awk</i> invocation. Awk variables are lexically scoped locals: each invocation has its <i>nf</i>, <i>fs</i>, <i>rec</i> and others.<p>* <i>awk</i> expression returns a useful value: the value of the last form in the last :end clause.<p>* can scan sources other than files, such as in-memory string streams, strings and lists of strings.<p>* supports regex-delimited record mode, and can optionally keep the record separator as part of the record (via &quot;krs&quot; Boolean variable).<p>* unlike Awk, range expressions freely combine with other expressions including other range expression.<p>* ranges are extended with semantic 8 variations, for succinctly expressing range-based situations that would require one or more state flags and convoluted logic in Awk: <a href="http:&#x2F;&#x2F;nongnu.org&#x2F;txr&#x2F;txr-manpage.html#N-000264BC" rel="nofollow">http:&#x2F;&#x2F;nongnu.org&#x2F;txr&#x2F;txr-manpage.html#N-000264BC</a><p>* strongly typed: no duck-typed nonsense of &quot;1.23&quot; being a number or string depending on how you use it. Only <i>nil</i> is false.<p>Recently accepted Unix Stackexchange answer featuring awk macro: <a href="https:&#x2F;&#x2F;unix.stackexchange.com&#x2F;questions&#x2F;316664&#x2F;change-specific-part-of-file-via-a-shell-script&#x2F;316752#316752" rel="nofollow">https:&#x2F;&#x2F;unix.stackexchange.com&#x2F;questions&#x2F;316664&#x2F;change-speci...</a>
评论 #18484826 未加载
jim_bailie超过 6 年前
Lua and AWK. I&#x27;m inspired! I&#x27;m going to rewrite the Perl 5 interpreter in Go. Take that Larry. Just kidding.<p>I&#x27;m all for scratching an itch, but why rewrite all these well established tools?
评论 #18479133 未加载
评论 #18480087 未加载
评论 #18486353 未加载
评论 #18479137 未加载
simplegeek超过 6 年前
I also really like such posts. I have never written an interpreter. What do experts recommend i.e. how can someone without a formal CS background learn about write an interpreter? Any good sources, articles, or books? Thanks in advance.
评论 #18482805 未加载
评论 #18482728 未加载
akavel超过 6 年前
Troff + pic + eqn ported to Go would be cool :&gt;
评论 #18480692 未加载
tyingq超过 6 年前
I wonder if there&#x27;s a file size + workload at which the coordination overhead of a parallel awk is low enough for an overall performance win.
IloveHN84超过 6 年前
Nice to see another implementation, but I still hope the original one will be always kept alive
评论 #18479509 未加载
AstroJetson超过 6 年前
While I&#x27;m cool with writing other language processors in a new language (Lisp written in Cobol anyone?) I&#x27;m missing the value of this past the bragging rights.<p>There was a similar article about writing the LuaVM in Go, to package it in bigger Go applications. I&#x27;ve done lots of C based systems and bolted Lua on, so the Go version makes sense.<p>But is imbedding Awk into a program that gets done on a regular basis?
评论 #18478531 未加载
评论 #18478403 未加载
评论 #18478847 未加载
评论 #18478703 未加载
LeoNatan25超过 6 年前
Why do so many modern projects feel the need to include the language and&#x2F;or the tech stack used as part of the project name? Is it a type of virtue signaling? Does “Go” or “JS” or “Swift” or “Node” make these project more attractive somehow to an end-user (even if the end-user is a programmer)?
评论 #18480071 未加载
评论 #18479385 未加载
评论 #18479309 未加载
评论 #18479476 未加载
评论 #18479643 未加载
评论 #18479655 未加载
评论 #18479356 未加载
评论 #18479795 未加载
评论 #18481302 未加载
评论 #18479628 未加载
评论 #18479883 未加载
评论 #18479269 未加载
评论 #18479728 未加载
TheJoYo超过 6 年前
party hard.
snug超过 6 年前
should have just named it gawk tbh
评论 #18479006 未加载
评论 #18478995 未加载
luckylittle超过 6 年前
I am hoping one day there is going to be an operating system, where every single tool is written in Go and everything runs in containers! Well done!
评论 #18478955 未加载
评论 #18478937 未加载