Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code in assembly Write and test a MIPS assembly language program to count each letter and digit in a text file. The program should do

code in assembly

image text in transcribed

Write and test a MIPS assembly language program to count each letter and digit in a text file. The program should do the following: a) Open a text file "data.txt" and read all characters into an array in memory. Limit the length of the array to 10000 characters. The maximum number of characters to be read should be 10000 characters. The actual number of characters depends on the file length. MARS provides the system calls for opening and reading a text file. If the file does not exist then the program should display an error message and terminates. b) Traverse the array character by character. Count all letters, digits, words, and numbers. A word begins with a letter (AZ or az), contains letters only, and ends at a character different from a letter. A number starts with a digit, contains digits only, and ends at any character different from a digit. For example, MIPS32 has the word MIPS and the number 32, even though they are not separated by spaces. Similarly, M5 has the word M and number 5. c) Display the total count of letters, digits, words, or numbers. If file "data.txt" does not exist in the same folder then output the following error message: Error: data.txt does NOT exist. If file "data.txt" exists then output the following: Letters =126 Digits =27 Words =35 Numbers =13

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions