An Awk Implementation in C99
raygard.net
raygard.net
ToC and preface of the new edition:
Luckly, the AWK library it's used for a project:
https://git.sr.ht/~luxferre/DALE-8A/blob/master/tgl.awk
Also, there's a solitaire written in POSIX AWK:
git://git.luxferre.top/nnfc.git
His homepage:
As far as I can tell, this implementation is much slower than other awks. Most awk implementations use a non-backtracking regex implementation (as do Rust and Go). By contrast, this seems to be using a backtracking implementation (e.g., like Perl and Python). For simplicity that makes sense, but for some regexes this kind of implementation can be many orders of magnitude slower.
My guess is that this slowdown doesn't matter for a typical toybox user, where small code size is valued. Thanks for the link!
I was looking over the POSIX spec to see what's so difficult about parsing it and just kind of wondering.
Anyone aware of a Python parser for the Awk language?
I found a number of Awk-alikes implemented in Python, but they all sounded like they took enough liberties that I wouldn't expect them to have a parser worth trying to lean on to parse wild Awk scripts.