News for hackers. Stuff that matters.
Re:The Awk Programming Language (1988) [pdf] by mpweiher on Saturday January 21, 2017 @04:08PM (#13452166)
The combination of "it worked fine" and "so not the right language" is intriguing. You wrote about the lack of data structures, can you share more (in both directions)?
Re:The Awk Programming Language (1988) [pdf] by david-given on Saturday January 21, 2017 @05:02PM (#13452375)
Bear in mind that this was twenty years ago, so it's not exactly fresh in my mind; but basically: it was intended to do one job, once, which was to compile the real compiler (written in a simplified version of the language) into bytecode. Once that worked, I would never need to touch it again.

Which meant that it was perfectly allowable for it to be hacky and non-future proof, which it was.

Here's part of the code which read local variables definitions (in C-like syntax):

    function do_local( \
    nt, st, n, t){
        nt = readtype()
        st = tokens
        ensuretoken(readtoken(), token_word)
        n = tokens
        outofscope(n, 1)
        ldb[n] = "var"
        ldb[n, "type"] = st
        ldb[n, "sp"] = sp - spmark
        emit("# local " n " of type " st " at " (sp-spmark) "\n")
tokens is the value of the current token, ldb is the symbol table; you can see how I'm faking a structure using an associative array indexed by keyword.

There's nothing actually very wrong with this code, but there's no type safety, barely any checking for undefined variables, no checking for mistyped structure field names, no proper data types at all, in fact... awk wouldn't scale for making the compiler much more complicated than it currently is. But it did hit the ideal sweet spot for getting something working relatively quickly for a one-shot job. It's still really good at that.

Re:The Awk Programming Language (1988) [pdf] by joepvd on Saturday January 21, 2017 @05:44PM (#13452506)
Some points:

* Cannot have an array as an input to a function

* Cannot return an array from a function

* Meta-programming or pointers are only (barely) available in gawk

* There is an `@include` statement for `gawk` that is not part of POSIX, and there is no name spacing involved.

* Functions names can only exist in the global name space

There are some reasons somebody felt an urge to create perl... Still loving awk, and using it every day for text processing jobs.

Re:The Awk Programming Language (1988) [pdf] by tyingq on Saturday January 21, 2017 @06:39PM (#13452738)
>There are some reasons somebody felt an urge to create perl

Larry Wall (creator of Perl) says something pretty close to that here[1]:

"I was too lazy to do it in awk because it would have been hard to get awk to jump through the hoops I was wanting it to jump through. I was too impatient to wait for awk to finish because it was so slow. And finally, I had the hubris to think I could do better."

[1]http://www.linuxjournal.com/article/3394

Re:The Awk Programming Language (1988) [pdf] by throwaway7645 on Sunday January 22, 2017 @09:48AM (#13455357)
I still think Awk is better for one-liners, but Perl gets the advantage for full size programs.
Re:The Awk Programming Language (1988) [pdf] by nickpsecurity on Saturday January 21, 2017 @09:59PM (#13453358)
I actually found it really interesting that he was working on a high-assurance VPN when he created it to reduce his grunt work:

http://cahighways.org/wordpress/?p=8019

http://ieeexplore.ieee.org/document/213253/

BLACKER's heavy lifting in security was done by high-assurance kernel called GEMSOS:

http://www.cse.psu.edu/~trj1/cse443-s12/docs/ch6.pdf

It was a classified work for TRW whose details took a long time to get released. Might be why he rarely mentioned the BLACKER project in its origins. Possibly trying to obfuscate it a bit to avoid breaking laws.