Index of /history.dcs.ed.ac.uk/archive/languages/imp77-tmp/gtoal/OLD/OLD2
Name Last modified Size Description
Parent Directory -
uninitcheck.c 2026-02-23 21:42 3.9K
uncomment.c 2026-02-16 11:06 4.9K
trace.c 2026-02-05 16:57 467
tables.h 2026-02-08 14:07 20K
symtab_priv.h 2026-02-08 14:07 1.2K
symtab.h 2026-02-08 14:07 4.8K
symtab.c 2026-02-08 14:05 17K
stringpool.h 2026-02-08 14:06 1.1K
stringpool.c 2026-03-03 23:32 2.1K
stdperm.inc 2026-02-08 14:09 9.3K
recordunions.txt 2026-02-22 20:37 7.8K
perms.inc 2026-03-07 18:17 14K
perms.h 2026-03-10 02:01 43K
perms.c 2026-03-10 02:01 39K
pass1-flat.c 2026-03-08 20:53 104K
noperms.inc 2026-03-06 22:16 11
imptoc.h 2026-02-08 14:07 1.8K
impsup-signals.c 2026-02-08 14:00 11K
impsig.h 2026-02-08 14:06 3.3K
icode.h 2026-03-03 23:31 912
icode.c 2026-03-06 21:35 7.4K
i2c.zip 2026-03-10 11:15 344K
i2c.h 2026-02-26 22:16 647
i2c.c 2026-03-10 11:11 104K
hello.imp 2026-02-21 12:07 62
goodbye.imp 2026-03-07 18:03 116K
goodbye.c 2026-03-10 11:12 300K
flex.h 2026-02-08 14:06 9.4K
flex.c 2026-02-08 13:59 9.2K
dltest.c 2026-02-21 21:04 2.2K
demo.c.html 2026-02-28 16:38 1.9M
codegen.h 2026-02-11 00:39 339
codegen.c 2026-02-14 15:01 2.0K
ast.h 2026-03-10 02:00 12K
ast.c 2026-03-10 10:34 113K
ack.lst 2026-03-06 21:11 5.9K
ack.lis 2026-03-06 23:19 5.2K
ack.imp2026 2026-03-06 23:40 3.0K
ack.imp 2026-03-06 21:11 254
ack.arm 2026-03-06 23:12 4.6K
README.txt 2026-02-25 13:51 2.7K
Makefile 2026-03-10 11:11 1.1K
This is my second attempt at a project I had put aside some years ago, which
was to use C as an intermediate language for code generation via ICODE. This
is *not* an imp to C translator, because the C is not for the users to look at;
it would be unmaintainable - that's what my main imptoc project is for. But
this is an alternative that seeks to use any C compiler as a back end rather
than having to interface to some C compiler's IL.
I'm now at the point where I can generate C code for most constructs, which
means I now have a framework in place for a relatively portable Imp77 compiler
that is written 100% in standard C. The last time I did this, I implemented
the ICODE opcodes first and never got a handle on the data types properly.
Now, with a few years more experience under my belt, I'm doing things in a more
sensible order and am generating more sensible constructs for records,
pointers, and arrays etc!
The generated code does have to be compiled under GCC. This is unfortunate but
no other C compilers seem to support Imp/Algol/Pascal-style nested procedure
definitions.
The code here is definitely 'Work In Progress' and is online just for you to
look at - please don't develop anything from this, as it will be changing
underfoot as I work on it. I'm updating the zip file nightly on each
checkpoint. There are still a lot of areas that I have not yet written code
for. Look for parts of the source files marked "TO DO"...
I am trying to keep the three components separated although I will confess
there may be a couple of places where they cross over in a less than pristine
way. Those parts are:
1) pass1-flat.c - more or less standard Imp77 pass1. Converted to C and
flattened for portability.
2) i2c.c - main control program and icode reader - handles the IMP side and
passes all code generation to...
3) ast.c - works from AST tuples (vaguely reminiscent of the ERCC's "trimp"
style) and generates the C.
The code *could* be shortened and simplified by mixing these phases more than
they are, but I think that this split should make the compiler more
maintainable than otherwise.
As of now there is no system-specific library interface (other than calling
standard C code) and the Imp perms are fairly generic and should be
recognisable to old Imp programmers.
Building the compiler is one step ('make') and it does attempt to adapt to the
user's environment a little.
Gnu C is currently a hard and fast requirement. Valgrind if present is used in
an attempt to emulate Imp's traditional runtime error checking.
G
(P.S. At some distant point in the future I will consider adding 'cosmopolitan c'
support which builds a sort of 'fat binary' that can run on multiple systems,
albeit only 64 bit ones.)