Title: CS 230
1CS 230
- HP 15C A Stack Calculator
2High Level Languages
- C
- Java
- Basic
- Cobol
- Fortran
- Pascal
- Algol
3Machine Languages
- Every CPU has its own machine language
- Commands are numbers
- CPU (Machine) does not understand High-Level
Languages!
4Example HP 15C
Architecture of the CPU - control unit (CU),
decodes instructions and initiates their
execution - arithmetic/logic unit (ALU),
performs arithmetic and logic operations -
registers, provides the storage workspace needed
for manipulating data.
5User Interface - keypad, used for inputting
data and commands - display, used for output
of results
6Sample Program
5 enter 2 /
Result displayed will be 2.5
7Reverse Polish Notation
- Operands are entered first, followed by operators
- Uses a stack to keep track of operands and
intermediate results - Final result is the value on the top of the stack
when the operation is completed
8Sample Program Revisited
In machine language, the previous program would
be
5 (alternatively, 28) 36 2 (alternatively, 38) 10