首页 >
> 详细

Computer Organization

University at Albany

Department of Computer Science

ICSI 404 – Spring 2022

Programming Assignment 2

Programming Assignment-2

Assigned: Tuesday, March 8

th, 2022.

Due: Tuesday, March 29th through your Blackboard account by 11:59 PM. Submissions with

20% penalty will be accepted by Thursday, March 31

st, by 11:59.

Objective

To acquire expertise in stack manipulation and management, subroutine linkage and return

conventions.

Description

You are to write a complete program in MIPS assembly language that evaluates arithmetic

expressions. The expressions must be fully parenthesized and include the following expressions

1. + (addition)

2. - (subtraction)

For simplicity all numbers in the expression will have only one base ten digit (0, 1, 2, 3, 4, 5, 6,

7, 8, 9) in them. Your program must be composed of four states: input, convert-to-postfix,

evaluate, and output states. At input data must be provided through the keyboard and stored as

an array of characters. After one expression is entered your program moves to the convert-topostfix

state. At this state your expression must be converted to the postfix notation using a

stack-based algorithm. Your program must then move to the evaluate state which evaluates the

postfix expression using a stack-based algorithm. At the output state your code must display the

complete expression in the postfix notation followed by the = symbol and the expression’s

numeric result.

Example

Some valid expressions and their corresponding postfix notations are:

a) ((1-3)+5) corresponds to 13-5+ in postfix notation.

b) (1-(3+5)) corresponds to 135+- in postfix notation.

Shown below is the Console display for expression a) above:

Console

Expression to be evaluated:

((1 - 3) + 5)

13-5+ = 3

Postfix Notation

2

Consider a set of all valid, completely parenthesized, infix arithmetic expressions consisting of

nonnegative integer digits, and the two operations +, -. The following definition gives all such

valid expressions:

1. Any nonnegative integer is a valid infix expression.

2. If a and b are valid infix expressions, then (a+b), and (a-b) are valid infix expressions.

3. The only valid infix expressions are those defined by steps 1 and 2.

The character string ((5-1) +3) is an example of a complete parenthesized expression. All valid

fully parenthesized infix expressions will have at least one operator.

Documentation

Your program must be developed using SPIM. It should be modularized and well commented. The

following is a tentative marking scheme and what is expected to be submitted.

1. External Documentation including as many pages as necessary to fulfill the requirements

listed below.

a. Title page.

b. [10%] Test documentation.

i. How you tested your program.

ii. Testing outputs.

c. [10%] User documentation.

i. How to run your program.

ii. Describe parameter (if any).

2. Source Code.

a. [75% total] Correctness.

The following expressions will be used for correctness verification.

i. [5%] (1+2)

ii. [5%] (1-(3+5))

iii. [10%] ((5-1) + 3)

iv. [10%] (4 – (1 – 2))

v. [10%] ((6-2) + (2-7))

vi. [15%] (((2+1) – 5) + (8 – 4))

vii. [20%] ((8+1) – (((3-1) +2) – 3))

b. [5%] Programming style

i. Layering.

ii. Readability.

iii. Comments.

3

What to Submit

The following are to be submitted through Blackboard:

1. Copies of all .asm files you created for this exercise as well as

2. Screenshots of the results produced by your solution.

All above listed information must be placed in a Microsoft compressed (zipped) folder (.zip).

Your .zip folder must be named: 404 Programming Assignment 2- Your Name. Marks will be

deducted if you do not follow this requirement.

联系我们

- QQ：99515681
- 邮箱：99515681@qq.com
- 工作时间：8:00-21:00
- 微信：codinghelp

- Fit5217辅导、Python程序语言辅导 2022-05-31
- 辅导ecs 170 Introduction To Artificial... 2022-05-31
- 辅导ecs 170 Homework Assignment 5 2022-05-31
- Fit 5003 Software Security辅导 2022-05-30
- 辅导cse 101 Data Structures And Algori... 2022-05-30
- 辅导econ7150、辅导java，Python编程 2022-05-30
- Econ7150编程辅导 讲解 S1 2022 2022-05-29
- 讲解cse 101 程序 辅导 Data Structures 2022-05-29
- 辅导fit 5003 Software Security 2022-05-29
- Stat7055 Introductory Statistics For B... 2022-05-28
- Assignment 3 Description: Computer Sy... 2022-05-28
- 辅导laboratory 程序、辅导program编程 2022-05-28
- 讲解eece 1080C Programming For Ece 2022-05-28
- Comp10002 Foundations Of Algorithms辅导... 2022-05-28
- 辅导 Swen30006、辅导java/C++编程 2022-05-28
- Comp326讲解导、辅导python，Java程序 2022-05-28
- 辅导 Dungeon Crawler C++ - Assignment ... 2022-05-27
- 辅导mast30025 Linear Statistical Model... 2022-05-27
- Prog2002辅导、辅导sql语言编程 2022-05-26
- 辅导 Info411/911 Data Mining Knowledge... 2022-05-26