The APL c compiler project
This is a compiler, which essentially translates APL to C code. It is
based on T. Budd's original work. Some liberties have been taken with
the language. It is basically experimental, and not guaranteed to be
good for anything. But I am maintaining it and would appreciate
hearing about bugs or problems, or ports.
I have been bringing the language closer to the standard (e.g. take
and drop now behave as expected).
I've just started adding complex support (v4), including the usual
complex numbers, quaternions, and octonions (Cayley numbers).
I've been meaning to have a language with all the numbers for a
while. Not sure about the transfinite ones yet...
The source code is known to compile on FreeBSD, HP, Solaris, SunOS,
Linux, Dec Alpha, SGI, Atari ST, DOS (using dj gcc; not tested in a
while). Probably not difficult to port to any unix system. As of 3.30
I'm using autoconf, which should simplify building and porting.
Currently this is split into a development version, which may have
unstable features, and a more stable version.
- complex numbers can be entered as 1i2 instead of the usual
mathematics notation 1 + 2 i
- Hamilton's quaternions include the complex numbers, plus two
more square roots of -1, 1i2j3k4. Note that quaternions are not
commutative. Various choices are possible for quaternion
multiplication tables, with 2 in common use. In aplc there are two
possible, though the standard is now the default
- 0i1*0j1 <-> 0k1
- 0j1*0i1 <-> 0k-1
- Here's the default multiplication table:
- Cayley's octionions include the quaternions, plus four
more roots of -1, U,I,J,K. An octonion can be entered in much the same
way as quaternions: 1i2j3k4U5I6J7K8.
There are 480 possible octonion multiplication tables.
They are not even associative, as demonstrated below:
- 0I1*0J1*0K1 <-> 0U-1
- (0I1*0J1)*0K1 <-> 0U1
APLc Language reference (TeX source included in distribution):
- Development Version. Added anonymous functions, functions as
values. Allow system fns with user ops, and vice-versa.
I've gotten tired of yacc/bison and have moved most of the
parsing to hand written parser. Much easier, probably because APL
isn't lalr or ... (maybe a packrat parser would be better?).
- Stable version (bug fixes):
Tim Budd's original code (.tar.Z)