by tannhaeuser · 2y ago · 0 comments
It was awk, grep, sed, and lex that popularized regexpes before. Perl attempted to agressively replace awk and sh, even shipped or still ships the a2p.pl script to perform limited awk-to-Perl code conversion. What Perl brought were Perl-style regexpes with capture groups and back references, which are still not characterized in terms of formal language theory when good decision procedures were the entire point of subsetting lexical analyses from eg context-free languages or other more capable models, which is particularly odd considering Larry Wall is a linguist.
Agreed on Larry Wall understanding the difference between linguistics and computer science, languages for humans to use vs languages for computers to use.
Perl code that is syntactically correct only on Fridays: https://news.ycombinator.com/item?id=30359309
(Has to do with how subroutine prototypes change how the code parsed where the subroutine is called)
Thankfully, gawk has capture groups, which makes it a very useful tool, unlike the awk shipped with macOS by default.
While awk is mostly used for text processing (and general data transforms, e.g. in the Linux kernel build system), it allows for writing arbitrary programs, e.g. first-person shooters: https://github.com/TheMozg/awk-raycaster