[comp.unix.questions] Awk to C translator

rh@ecs.soton.ac.uk (R Harrison) (07/21/90)

In article <234@malathion> ramsey@malathion (Ed Ramsey) writes:
>and I was hoping there was a free or inexpensive way to translate
>my AWK source into compilable C code.  Does anyone know of such a
>beast?
The UNIX System Toolchest has a tool called awkcc which may be suitable.
To get more information contact the Toolchest by email on tc-info@uel.co.uk 
(an info server, try subject: help or index). 
Hope that helps :-)
R.Harrison. 

A_DOUGHERTY@acc.haverford.edu (Andy Dougherty) (07/25/90)

>and I was hoping there was a free or inexpensive way to translate
>my AWK source into compilable C code.  Does anyone know of such a
>beast?
I have had good luck with a2p, the AWK to perl translator.  It produces
perl, not C, but might be suitable.  a2p comes with the perl package.

vlb@magic.aux.apple.com (Vicki Brown) (07/27/90)

(Lost the orignal posting...sorry):
>>and I was hoping there was a free or inexpensive way to translate
>>my AWK source into compilable C code.  Does anyone know of such a
>>beast?

The AT&T ToolChest sells awkcc, an awk-to-C translator.  It's relatively
inexpensive (< $200 (source) as I recall).  It's quite well documented.

This isn't necessarily a recommendation.  I tried it over a year
ago, and it didn't handle some things I did in new awk, and the C it
produces is really weird - maybe a good candidate for the Obfuscated C
contest!  So I decided my awk code was fast enough.

However, it is out there, and it may have been improved.  Also, it probably
works well on simpler scripts (mine rarely are :-).  

The author of awkcc does make the following comment: Unless running a
program is expensive, one should not compile it... High-level programs
cannot be improved much by compilation.

You can browse the Unix System ToolChest by dialling +1 (201) 522-6900
and logging in.  The login is guest.