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
Q. Explain Structure of Control Unit? A control unit has a set of input values on the foundation of which it produces an output control signal which in turn performs micro-ope

Question: 1. In Flash, what is the purpose of a motion guide layer? 2. Differentiate between Motion and Shape tween. 3. Give the steps to create a layer mask in flash.

Learning Weights in Perceptrons - Artificial neural network In detail we will look at the learning method for weights in multi-layer networks next chapter. The following descri

Arbitrary categorisation - learning decision trees: Through visualising  a set of boxes with some balls in. There if all the balls were in a single box so this would be nicely

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

how to find the integral of a function represented by collection of experimental data

The field that contains a segment index or an internal index is called ? Ans. Target datum consists of a segment index or an internal index.

The PHP Hypertext Pre processor is a programming language that permits web developers to make dynamic content that interacts with databases. PHP is basically used for developing we


DEscribe a console application to show all the arguments passed tocommand line whereas running the application. The user can pass anynumber of arguments that should be shown. Use l