TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

awkcc: awk-to-C transcompiler (1988, 2011)

74 pointsby rdpintqogeogsaaover 3 years ago

6 comments

gompertzover 3 years ago
I actually have this code compiling and running from a few months back with some minor compiler corrections; but was hesitant to release to github because of the copyright. It was very difficult to come across.<p>I asked several people at Bell&#x2F;Nokia if it would be okay to release and they weren&#x27;t sure if anyone cared (but couldn&#x27;t guarantee anything legally) ... Looks like they took the liberty themselves...<p>I&#x27;ll try to find time to do a PR or fork of this copy with my corrections and writeup for instructions. Imagine it&#x27;s best I just fork as can&#x27;t fathom Nokia is going to approve PRs.
评论 #29878151 未加载
评论 #29867192 未加载
benhoytover 3 years ago
Interesting! I recently did something similar based on my GoAWK interpreter (an AWK interpreter written in Go): I wrote a compiler that tries to statically infer types and compile a subset of AWK to Go source: <a href="https:&#x2F;&#x2F;benhoyt.com&#x2F;writings&#x2F;awkgo&#x2F;" rel="nofollow">https:&#x2F;&#x2F;benhoyt.com&#x2F;writings&#x2F;awkgo&#x2F;</a> My conclusion:<p>&gt; Is it useful? Not really. If you want performance, just use Mawk! And if you want your text processing script in a more maintainable language than AWK, you’d probably just write it in something like Go from the start. You’re pretty certain to end up with more idiomatic Go that way, and it’ll probably be more efficient as well.<p>&gt; Still, if you have some AWK scripts lying around that you want to convert to “real programs”, AWKGo might not be a bad place to start: you could compile a script to Go to get the structure, then clean it up and maintain the cleaned-up version.
cogburnd02over 3 years ago
Interested parties should also check out awka (<a href="https:&#x2F;&#x2F;github.com&#x2F;noyesno&#x2F;awka" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;noyesno&#x2F;awka</a>) and ELVM (which can compile C into awk or sed, among various other things) (<a href="https:&#x2F;&#x2F;github.com&#x2F;shinh&#x2F;elvm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;shinh&#x2F;elvm</a>)
评论 #29868150 未加载
tyingqover 3 years ago
<i>linux build: Lex needs to be run on Solaris machine. awk.lx.c is built on solaris, then modified by hand to remove the static initialization of yyin and yyout.</i><p>That kind of situation is a fun throwback.
deegover 3 years ago
A long time ago MKS Utilities had an awk compiler that would compile an awk script into a Windows exe. Dunno if it actually compiled anything or just packaged the awk interpreter onto the exe. That was my first intro to awk. Was nice to be able to write a script that I could send to people who didn&#x27;t have awk.
watersbover 3 years ago
I love AWK for some dead-simple borderlands between sed and Perl (or worse). But the performance can be a problem with associative arrays.