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 (A-Z or a-z), 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
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 (A-Z or a-z), 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
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.3: Random File Access
Problem 6E
Related questions
Question
Please written by computer source
code in assembly
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr