Machine Problem 2, due at the end of Sept 30
Part of
the homework for CS:2630, Fall 2019
|
Framework: Your program must begin and end as follows:
TITLE "mp2.a by Your Name Here USE "hawk.h" USE "stdio.h" ... your code hre ... USE "/mnt/nfs/clasnetappvm/fs3/dwjones/2630mp2.h" END
Obviously, where it says Your Name Here put your name, and where it says ... your code here ... put SMAL Hawk code to solve the problem.
Details: The last header file mentioned above, ...2630mp1.h defines the following symbols:
All the data structures described above are in read-only memory, so your program may not modify any of them.
Your job is to traverse the tree and print the strings (without adding any newlines or other output) in lexicographic order (also known as an inorder traversal). Your best bet is to do so using a main program that calls a recursive tree-traversal routine.
Grading: 5 points. Correct output is worth 2.5 points. The remaining credit will be offered only for those who have correct output.
Code that does not assemble will not earn any credit.
Stylistically clean code is important; that is why half the credit is reserved for style, but only if the code works. Bad indenting will be penalized up to 1 point from the 2.5 style points. Excessive or inadequate white space within and between lines will be penalized, again, up to 1 point. Excessive or inadequate comments will be judged similarly.
Note: Comments should not repeat the assignment. Assume that the reader of your code has read the assignment. Assume that the reader knows how to program, so commenting ADDSI R1,1 with R1=R1+1 would be stupid. Comments should help the reader when the code is hard to follow.
Before you submit: Assuming your code is in a file named mp2.a, please use the command
[HawkID@fastx?? ~]$ ~dwjones/format mp2.a
This will gripe about over-length lines, strange mixing of tabs and spaces, and other file-format issues that will make your code hard to read when printed out for grading but might not be obvious when you have the file open for editing.
Submission: To submit your work, it must be in a file named mp2.a in your current directory on the CLAS Linux system, and you must know your section number. In the following transcript of a submission, what you type is shown in bold face.
[HawkID@fastx?? ~]$ submit mp2.a Course (for CS:1210 use CS1210): CS2630 Possible submit directories for /group/submit/CS2630 are: mp2/a3 mp2/a2 mp2/a4 mp2/b11 mp2/b12 mp2/b13 Choice: mp2/a2 * File/directory mp2.a has been * copied to /group/submit/CS2820/mp2/a2/mp2.a.HawkID. [HawkID@fastx?? ~]$
The output saying "File ... has been copied ..." is your confirmation of successful submission. In the event of insurmountable trouble, do not delete or edit files you have submitted. Keep them around. It is safe to make copies if you want to keep playing with them. Keep the original on the CLAS Linux system until your graded work is returned. This way, the time stamp marking the time of last edit is a trustworthy indicator of whether you did the work on time.
Historically, students unable to successfully complete MP2 for this course have demonstrated very hazy understanding of recursion. A second problem is a failure to distinguish between local control structures like loops, which are done with conditional and unconditional branch instructions, and calls, which are done with JSR and JSRS instructions. If this assignment proves daunting, seek help early!