TC0: A stack-based calculator
We’ll begin with a very simple stack-based calculator. Here, we’ll introduce a zero-address machine that avoids explicit operand addresses by storing data on a stack. We have included the notion of a stack-based computer for two reasons. First, it forms the basis of many classic calculators, a programming language (FORTH) and the design of a classic computer (Burroughs B5000). Second, constructing a stack-based computer is very easy and you can experiment with this class of computer. Indeed, elements of a stack-based processor can easily be incorporated into any computer. In a conventional computer, two elements are added with an operation such as ADD A,B,C
. In a stack-based computer, two elements are added with ADD
. There is no need for operand addresses because the elements to be added are the top two in a stack.
The computer we describe here is called TC0 to indicate that it is a proto-simulator, rather than a full simulator (it cannot...