Paul Koning wrote:
Huh?
You're confusing the lack of a hardware stack with the lack of local
variables. They are not at all related.
But the IBM does have INDEX registers that makes emulating a stack easy.
The IBM 360/370 series doesn't have a stack, and
some of its
restrictions are vaguely PDP-8 like. Nevertheless, GCC supports C
(and C++) quite nicely on those machines.
But GCC does not need to fit into 4096 words of memory. If you compiled
C into
a P-code type code I am sure you would have no problems but a very tiny
memory
space.
For that matter, Algol had local variables long before
C was invented,
and as you pointed out, there's an Algol for the PDP-8. (Then again,
that's not a true compiler -- it compiles to an intermediate form that
looks very much like a subset of the Burroughs 5500 instruction set.)
And Unix originally appeared on the PDP-7, which you can describe
quite reasonably as an 18-bit superset of the PDP-8. (That's
historically nonsense, but as a description it fits.) Did C exist
back then, or did that wait until Unix was ported to the PDP-11? I
don't know.
C was developed around the time Unix was developed but only one they
ported did they
have a real machine to use. Primeval C ==
http://www.cs.bell-labs.com/who/dmr/primevalC.html
Finally, CDC 6000s don't have a stack either, but
the first Pascal
compiler ran on that machine. Implementing a stack on a non-stack
machine (or non-stack language like Fortran-II) is a nice elementary
Exercise for the Student.
But if you have subscripted varibles, then you can have stacks and other
data structures.
you have to do the work the hard way rather than use hardware.
paul