I want a new Awk
Things I want in an Awk
- Embeddable in C/C++
- Extensible via C/C++
- Module or include ability for other awk code
- better local variable support
- better support for pipelines / coprocesses – either like |& in Gawk or
- No artificial limitations on open files etc.
I think that all of these things could be achieved without breaking compatitibility with traditional Awk syntax. I think a few possible syntax extensions could be added, but which would degrade gracefully into traditional awk when not used (basically a local variable syntax, and “’s or |&).
I think that making Arrays like Lua’s tables wouldn’t effect the current semantics, but would allow a form of object orientation, and modularization. Promoting Arrays and functions to first class values so they can be passed around, would also greatly increase their power.
Gawk already includes a basic file include mechanism. Something like that would probably be sufficient, as long as Arrays could hold function values for modularization.
All the rest of the items are really issues of architecture. I basically want to steal all the good stuff from Lua and backport it to Awk. Lua is ridiculously fast for a scripting language, I’d like to try to see that same kind of speed for Awk where possible. I’d like to turn Awk into a full scripting language that is capable of the same kinds of glue tasks that other full scripting languages can handle.
The only other major issue is licensing. I’d like this awk to be available under a BSD style license so that it could potentially be used in the same kinds of embedding scenarios that Lua is used for. Currently the most full featured awk (Gawk) is GPL, which limits the ability to embed it into commercial software.