[gnu.gcc] retargetable assembler in gawk

ara@LOM1.MATH.YALE.EDU (Allan Adler) (12/29/89)

Forgive me for not knowing the right mailing list for this, but I really
don't know...

According to the gawk manual, p.145, Henry Spencer of the University of

Toronto wrote an assembler in gawk which is several thousand lines long,
which contains many machine descriptions, which it is claimed should
have been written in some other language and which is allegedly
part of the gawk distribution. Can someone tell me where in the gawk
distribution ? And if it is no longer part of the distribution, can someone
tell me where one finds this program ?

Allan Adler
ara@lom1.math.yale.edu

henry@utzoo.uucp (Henry Spencer) (12/29/89)

[I don't normally read this group, but a friend pointed this out...]

In article <8912290059.AA16370@LOM1.MATH.YALE.EDU> ara@LOM1.MATH.YALE.EDU (Allan Adler) writes:
>According to the gawk manual, p.145, Henry Spencer of the University of
>Toronto wrote an assembler in gawk which is several thousand lines long,
>which contains many machine descriptions, which it is claimed should
>have been written in some other language...

This isn't quite right.  It's the Amazing Awk Assembler.  I wrote it in
ordinary pre-GNU awk (with some sed and other Unix programs mixed in),
not gawk (although the gawk folks did use it as one of their test cases,
since it's a moderately substantial body of awk code with regression tests).
As shipped by me, it is about 2500 lines, 41KB, including the (skimpy)
documentation.  Roughly 2/3 of that is two sample machine descriptions
in a somewhat redundant form.  As shipped, it can assemble 6801 or 6809
assembler (its own syntax, not a standard one) to Intel hex load modules.
Within the general family of machines it can cope with (8-bit micros,
although it could be stretched to others with work), retargeting it
basically amounts to typing in the opcode list and writing a few lines
of awk for each notation invented for a funny addressing mode.

AAA is slow, its input syntax is limited and eccentric, its response to
errors is poor, its retargetability is limited, and if a retargetable
assembler had been the objective, C would certainly have been a better
choice of implementation language.  I did it because I wanted to see
if it could be done, and because I had some uses for a simple assembler
that didn't justify building a production-quality product.  It can be
done, and it is of some use.  For those purposes, awk was the right language.

>... And if it is no longer part of the distribution, can someone
>tell me where one finds this program ?

I can't tell you whether it's shipped with gawk, but the comp.sources.unix
archive has my original distribution.
-- 
1972: Saturn V #15 flight-ready|     Henry Spencer at U of Toronto Zoology
1989: birds nesting in engines | uunet!attcan!utzoo!henry henry@zoo.toronto.edu