Awk to C translator available

THEIVENDRA LEONARD WIJENDRAN <theiven@ecf.toronto.edu>
8 Jun 1996 18:30:44 -0400

          From comp.compilers

Related articles
Awk to C translator available theiven@ecf.toronto.edu (THEIVENDRA LEONARD WIJENDRAN) (1996-06-08)
| List of all articles for this month |
From: THEIVENDRA LEONARD WIJENDRAN <theiven@ecf.toronto.edu>
Newsgroups: comp.compilers
Date: 8 Jun 1996 18:30:44 -0400
Organization: Compilers Central
Keywords: C, translator, available

This is to announce the first beta release of an AWK-to-C Translator that
I've been developing for the past few months. It is based on GNU awk (GAWK)
and is supported on various Unix platforms as well as Windows NT/95, MS-DOS,
OS/2 on PC systems.


It is at a stage where I think many of you will find some practical use for
it. I've been doing most of the development on Linux and have occasionally
tested it on Windows NT. So far, it seems to work on every warped testcase
that I've thrown at it. The translator currently supports all the core
feature of AWK (i.e. associative arrays, regexp matching, etc). Features
not implemented yet (will perhaps be in the next release):


  - All builtin functions (i.e: printf, gsub, split, etc). Note however that
      the 'print' statement is supported which takes the translator out of the
      realm of uselessness :-)
  - String concatanations
  - The 'for XX in YY' statement (assoc. arrays are otherwise fully supported)
  - I/O re-direction within AWK program
  - Variable initializations via command line
  - User functions




I suppose most of you are wondering about the speed improvements over
interpreted awk scripts... My tests show, that depending on the nature
of the AWK program and the size of the input set, speed increases range
from minimal to over 2000% (20+ times as fast). The translator features
an optimizer which analyzes the variables and number <-> string type
conversions they undergo, and then emits optimal C code to maximize runtime
performance. Please refer to the 'README' file and 'Technotes' file in
the doc/ subdirectory of the package for further details.


Generally, if your AWK program involves loops, fair to intense expression
processing, or is generally large, then the speed improvement is greater.
Also, as the number of input records increase, the speed improvement also
gets better (regardless of the nature of the AWK program).




Where to get it / Installation
------------------------------


I'm still looking for a primary site to house this package. For the moment,
I'll upload it to ftp://ftp.cdrom.com/pub/win95/incoming and
ftp://sunsite.unc.edu/pub/Linux/Incoming. The file is 'awk2c050.tgz' (gzipped
tar file).
Please note that it falls under the GPL license.


Read the 'README' file in the 'doc/' subdirectory for instructions on
configuring/installing/using it under your operating system and C compiler.
For those who interested in the design of the translator, look at the
'Technotes' file in the same subdir.




I'll be interested in any comments you have (including problems/bugs). You
can either e-mail me at the first address shown below or post to the
comp.lang.awk newsgroup.




Leonard Theivendra
IBM Toronto Software lab
------------------------------------------------------------------------------
E-Mail: theiven@skule.ecf.toronto.edu (<= 08/31/96)
                  theivend@torolab6.vnet.ibm.com (>= 07/01/96)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.