Develop a calculator in masm, Computer Engineering

Assignment:  develop a calculator in MASM.

Text chapters covered:  1 through 4, 5.4, 5.5, 6.3, 7.4

You will develop a "calculator" algorithm in MASM using reverse-polish notation (RPN).  RPN is an extremely useful technique to calculate algebraic expressions.  It is used by many compilers to process algebraic statements.  Your calculator will evaluate RPN expressions using INTEGER values only.

RPN is a postfix expression, meaning that the operation (add, subtract, etc.) follows the variables.  Contrast this to an algebraic expression where the operations are situated between the variables (this is called infix notation).  Here's an example of an RPN expression and its algebraic equivalent:

                        Algebraic equation:     E(A+B)/C-D

                        RPN equivalent:          AB+E*CD-/

To compute an RPN expression is a straightforward process using stacks.  Assume that the RPN expression is always presented as a character string.  The algorithm to do this is shown below.

1. If the character encountered is a variable, push the variable on the stack.

2. If the character encountered is a operator (+,-,*,/), pop the top two variables off the stack, perform the operation on them, then push the result back on the stack.

3. Continue steps 1 and 2 until the string is exhausted.  The last value on the stack is the final result.

Posted Date: 2/25/2013 1:55:35 AM | Location : United States







Related Discussions:- Develop a calculator in masm, Assignment Help, Ask Question on Develop a calculator in masm, Get Answer, Expert's Help, Develop a calculator in masm Discussions

Write discussion on Develop a calculator in masm
Your posts are moderated
Related Questions
What are the different message types available in the ABAP/4 ? There are 5 types of message types available. E: ERROR W-WARNING I -INFORMATION A-ABNORMAL TERMINA

SMTP Simple Mail Transfer Protocol, a protocol for sending e-mail messages among servers. Most e-mail systems that send mail over the Internet use SMTP to send messages from si

Version Control is a critical tool in development and production environments that allows a user to make snapshots of working con?gurations or code. In this assignment, you will de

Categorized Optimization transformations The structure of program and the way in that data is defined and used in this provide vital clues for optimization. Optimization t

Minimum possibility -minimax algorithm: Finally, we want to put the scores on the top edges in the tree. So there is over again a choice. Whenever, in this case, we have to r

Tools for Performance Measurement The reason behind these algorithms has been to gain a speed up and improve the performance. After the parallel algorithm has been written and

Q. Illustrate working of rubber dome keyboards? Rubber Dome: In rubber dome keyboards both positioning and contact are controlled by a puckered sheet of elastomer that is a s

what would be the occupancy of each leaf node of a B+ tree

Entropy - learning decision trees: Through putting together a decision of tree is all a matter of choosing that attribute to test at each node in the tree. Further we shall de

Perceptrons: However the weights in any ANN are usually just real numbers and the learning problem boils down to choosing the best value for each weight in the network. Becaus