-
To evaluate an expression without any embedded function calls
-
- one stack is enough
- two stacks are needed
- as many stacks as the height of the expression tree are needed
- a turning machine is needed in the general case
- one stack is enough
Correct Option: A
A stack machine implements registers with a stack. The operands of the arithmetic logic unit (ALU) are always the top two registers of the stack and the result from the ALU is stored in the top register of the stack. 'Stack machine' commonly refers to computers which use a Last-in, First-out stack to hold short-lived temporary values while executing individual program statements. The instruction set carries out most ALU actions with postfix (Reverse Polish notation) operations that work only on the expression stack, not on data registers or main memory cells. The same opcode that handles the frequent common case of an add, an indexed load, or a function call will also handle the general case involving complex subexpressions and nested calls