Discussion:
The AWK book’s 60-line version of Make
(too old to reply)
Ben Hoyt
2023-09-10 22:44:13 UTC
Permalink
For your interest, I just published an article about the minimal version of Make (written in a page of AWK) that's included in the book "The AWK Programming Language":

https://benhoyt.com/writings/awk-make/

It's a neat program, and in the article I describe how it works, as well as porting it to a Python version for comparison.

The Make program is included in the second edition of the book, which is coming out next month!

-Ben
Andrew Schorr
2023-09-11 16:08:26 UTC
Permalink
Post by Ben Hoyt
https://benhoyt.com/writings/awk-make/
Nice. Just FYI, the gawk filefuncs extension does include a stat() function that would enable you to
eliminate the ages function and age map just as in Python. See "man 3am filefuncs" or the manual:

https://www.gnu.org/software/gawk/manual/html_node/Extension-Sample-File-Functions.html

And of course gawk also has true multi-dimensional arrays, so that could also make things prettier
and more concise.

Regards,
Andy
Ben Hoyt
2023-09-11 16:59:32 UTC
Permalink
Post by Andrew Schorr
Nice. Just FYI, the gawk filefuncs extension does include a stat() function that would enable you to
Ah, excellent, thanks for the link. Yeah, that's much more direct (and more efficient!) than shelling out to "stat" as I did in my modified AWK version. (Though for the book I'm pretty sure Kernighan et al are trying to stick to standard AWK features.)

-Ben

Loading...