Write a SMAL Hawk program to emulate an RPN calculator.
Each character on the line of input has meaning as an instruction to the calculator. Your main program should repeatedly read lines of input from the keyboard and perform the operations indicated by that line, starting with an empty stack.
Characters on each input line are scanned left to right; each character has meaning, either requesting a computation or requesting output, as follows:
Input: E12E6-P E12E7E6-*E12B E160E2*E10/P
Output: 6
Output: 10
Output: 32
Your program should detect stack underflow and print an error
message in that case. Your program need not process input lines longer
than 80 characters. Your program should use a procedure that prints output
in any number base, possibly a procedure based on your solution to MP1.
Until terminal input is fully supported (there are a few problems), please work with a simplified main program that uses a line of input coded into an ASCII directive, for example:
LINE: ASCII "E12E6-P E12E7E6-*E12B E160E2*E10/P",0
E-mail will be sent out when a good input routine is available.