Kernighan's awk C++ translator

  • Aaron S. Hawley

    Aaron S. Hawley - 2002-12-18

    Brian Kernighan (the 'K' in awk) wrote an AWK to C++ translator, and wrote a paper on his results.  They're on his website:

    Here's the paper

    I hate C++ as much as the next Joe, but perhpas some of these design elements can be incorporated into awka.  Specifically, the attempt for outputted code that matches closely to Awk's.

    • Andrew

      Andrew - 2002-12-24

      Yes, I too read that paper, but unfortunately it was after I'd done most of the work on Awka's translator rather than before.

      With C it is exceedingly difficult to make the translated output bear any resemblance to the original AWK program, mostly due to the undefined typing of awk variables.  C++ would do a far better job to be sure, but I had reservations, thinking that very few people would be able to take the time and effort needed to understand and use the classes properly.

      Awka's main reason for being is speed and distribution as a binary. The original AWK program can be maintained, tested in an interpreter and regenerated at any time, so I didn't see the need to try to implement anything like the C++ model on top of it.

      Not to say it shouldn't be done of course; if anyone would like to I'd be glad to see their work included in Awka for everyone's benefit.

      Merry Christmas btw :-)

    • Nobody/Anonymous

      Como eu fao para encontrar um comando em C , mais no imprimir por exemplo o ; , isto  encontrar por exemplo for; s que s pode encontrar o for e eliminaro ;.


Log in to post a comment.