Completed

Mars Mips Assembly program

This project was successfully completed by greenvector for $30 USD in 4 days.

Get free quotes for a project like this
Employer working
Completed by:
Skills Required
Project Budget
$10 - $30 USD
Completed In
4 days
Total Bids
1
Project Description

Ask the user to input a string of expression in RPN form (+ - * / ), use a stack to evaluate the
result and display the result (in decimal) on screen. The numbers and operations in the RPN
expression are assumed to be separated by (one or more) spaces. Assuming no negative
numbers in the input (but intermediate results might be negative).


Calculate single-digit RPN in valid forms. For example:
3 4 – 2 7 + * 4 / = -2 is a valid RPN
Allowing multi-digit numbers, and detecting illegal RPN
expressions. For example:
3 100 105 - + 433 * = -866 is a valid RPN
3 100 105 - + * 433 is invalid
3 abc 105 - + 433 * is invalid
Extra Goal a) (20 pts): achieving the above levels for both RPN and PN. For example:
3 100 105 - + 433 * = -866 is a valid RPN
- 120 / * 3 12 - 42 36 = 114 is a valid PN
- 120 3 100 105 - + 433 * is invalid
b) (20 pts): support of real numbers:
0.3 [url removed, login to view] [url removed, login to view] - + 3 * = [url removed, login to view] is a valid RPN
:
First, you need to prepare a stack structure that supports push / pop, etc.
a) From left to right, go through every character of the expression, do the following:
i. if the character is a digit (0 – 9):
convert the ASCII to integer and push that number onto stack
ii. if the character is an operation (+ - * / )
1. pop from the stack a number -> A
2. pop from the stack a number -> B
3. calculate B op A ( for /, use quotient as result and ignore remainder).
4. push the result number back onto stack
b) Pop out from stack -> final result

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online