>>>> "Allison" == Allison
<ajp166 at bellatlantic.net> writes:
Allison> Correct. But a stack makes some forms of programming
Allison> easier.
Sure, just like CISC instructions make some things seem easier. (They
actually shift the burden to a different spot.)
> 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.
Allison> IBM360 like a PDP-8???? Explain please.
Small directly addressable range (128 words for the 8, 4k for the
360) is what I was thinking about.
> 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.)
Allison> Using an IL was a way of making the complier easier I'd
Allison> guess. Compiler deign has become more sophisticated since.
I believe the main reason is to make the code smaller. P-code
compilers have been used on the PDP-11 (the Algol compiler was ported
there, and Fortran-4 was P-code). Basic-Plus is P-code of course, and
so is Forth. Then there is UCSD Pascal.
> 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.
Allison> Be very careful what you call a stack or not. The PDP-8
Allison> (Straight 8) has no hardware stack but, it has autoindex
Allison> registers that are very handy for stack implmentation. It's
Allison> also not hard to store a return address elsewhere to
Allison> implement subroutine recursion. Later PDP-8a and the 6120
Allison> chip versions had a real hardware stack added. The stacks
Allison> were implemented using IOTs so it was possible to add them
Allison> to any -8. The lack of a return stack doesn't mean there
Allison> isn't a set of addressing modes to implement a software
Allison> stack from all the minis and micros I've seen.
Sure. But my point is that, even when you have NO help from the
processor instruction set, you can do a block oriented language. The
Cyber is about the most unhelpful architecture you can find: no stack,
no autoincrement registers, function call works by writing the return
address into the first word of the function, etc. And sure enough,
Wirth bitched a lot about that, but the compiler works, anyway. In
fact, it worked well enough that the first VMS Pascal compiler was a
quick hackjob on the Cyber compiler -- you can still see the Cyber
code patterns when you look at the VAX machine code that VAX Pascal
V1.0 generates -- which is quite hilarious.
paul