Open

MIPS

This project is ending in 1 day and has an average bid price of $264 USD.

Get free quotes for a project like this
Employer working
Project Budget
$30 - $250 USD
Total Bids
9
Project Description

PART 1 : Infix Expression calculator

Write a program that takes in, as a string, an expression in the Infix format and calculates its output. The program asks then the user for the next expression until the user hits the character ‘E’ which will terminate the program.

• Follow the stack implementation discussed in class: it is mandatory the explicit usage of the stack in your code.

• Make use of function calls whenever you see fit – functions must be present in your code.

• Numbers in expressions are multi-digit non-negative integers (but intermediate and final results can be negative integers); both numbers and the final result can all fit into a word.

• Operations can be +,-,* and / Examples:

- Input: ((2-(8+9))*(1-4)) Output: 45

- Input: (7-(((6+2)–4)*8)) Output: -25

- Input: ((3*((205–102)+5))/(42–49)) Output: -46

On top of the previous requirements, your program should also be able to:

• Handling division by zero, by reporting an error to the user without crashing the program; • Provide also an error in case of incorrect expression format and parenthesis pair

mismatch. Examples:

o Input:((10000*2))+(5/3))àOutput:Error:parenthesispairsmismatch

o Input:((4+6.5)-(50*2)+(8-2)+4)àOutput:Error:incorrectexpression format

Part 2- separate program : Linked list manipulation

Implement a program which contains, in the .data, a linked list made of sets of combos organized as follows. Be careful: in the .data definition each combo has to be defined SEQUENTIALLY (first, then 1 and its pointer, 2 and its pointer,... until 8 and its pointer). Sketch carefully a MIPS memory layout table to figure out the values of each of the pointers so that the linked list points exactly like in the figure below:

SEE ATTACHMENT

As you can see, in terms of memory layout ‘8 and its pointer’ are the last two items defined in memory, but this combo IS NOT THE LAST LINKED LIST ITEM!

- Order in memory: 1,ptr,2,ptr,3,ptr,4,ptr,5,ptr,6,null,7,ptr,8,ptr

- Linked list order: 5,ptr,1,ptr,4,ptr,3,ptr,2,ptr,8,ptr,7,ptr,6,null

Then, inspiring your code to Listing #15 discussed in class (see Blackboard), and using functions:

• Ask the user for eight numbers to fill the list that the user will input sequentially, following the list order (not sequential order in memory). Perform full input check: the user must insert word-length numbers and nothing else! If an error is encountered on the input format, insist on asking the user to insert a valid number before proceeding any further.

Once the input is correct, save it in the current combo and proceed to the next one;

• Then, print the structure as linked list;

• Then, print the structure as combos in ascending order (from the smallest to largest user

input) and terminate.

Make use of functions!

With respect to the previous requirements, your program should also be able to:

• First, ask the user how many values he or she would like to input (this parameter must be

a minimum of 1 and a maximum of 8);

• Then, according to such parameter, fill in the linked list and realize then the operations of

printing as linked list and as combos in ascending order (like in Part 1);

• At this point, ask the user whether he or she wants to insert a new linked list (overwriting previous values) by letting the user inserting a new parameter (number between 1 and 8) and then accepting the new sequence of numbers, or terminate (user parameter input =

-1 in the second scenario). Again, full input check is expected.

The tricky part here is to properly initialize the linked list and then modify the position of the “null” according to the first user input (the parameter expressing number of values to be saved). Make use of functions!

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