3 ms·
Oblique, but since this topic might be catnip for people who'd know: Anyone aware of a Python parser for the Awk language? I found a number of Awk-alikes impl
by abathur 3y ago
Oblique, but since this topic might be catnip for people who'd know:
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.
- nerdponx 3y agoIs there a Tree Sitter grammar for AWK? That could be a good way to go, via the Python bindings for Tree Sitter.
- mananaysiempre 3y agoYou would probably get reasonable results from simply feeding the POSIX grammar to lrparsing[1], but unfortunately it doesn’t look like there’s much support in it for lexer feedback (aka the “lexer hack”), which you’ll need for the regular expression syntax. It’s likely possible to hack that in, but I don’t know how much work it’d be. [1] https://lrparsing.sourceforge.net/ https://lrparsing.sourceforge.net/