CPSC 220, Fall 2018
Lab 12: Larc Assembler, Part 2
For this week, you will continue to work on your "Lasm" assembler for our Larc assembly language, which was begin in the previous lab.
This project is due on Monday, December 10, at 3:00 PM. If you have not made changes to any file besides Lasm.java, it is sufficient to turn in that file to your homework folder. If you have changed other files or added new files to the project, please turn in the entire lasm source folder. I will look in the homework folder for a folder named lasm or, if that does not exist, for file named Lasm.java. Only one member of a team should turn in the work. Please be sure that both names are listed in a comment in Lasm.java!
Bug Fix
As I mentioned, my Larc parser is new code, which probably has some bugs. I have found and fixed one bug, which prevented the parser from handling the lbi instruction correctly. You should get the corrected version of Parser.java and substitute it for the original version in your project. There were also typos (noticed by AJ McFarlane) in Parser.java and in Label.java that would allow some strings that are not legal labels to be accepted as labels. So you should also get a corrected copy of Label.java. You can find the corrected Parser.java and Label.java in /classes/cs220/lasm (or use the links in this paragraph).
About the Test Programs
Two new test programs have been added to /classes/cs220/lasm_test_programs since the previous lab. The program test_pseudo.s uses all of the pseudo-instructions that Lasm adds to the basic Larc instructions: la, lbi, lwa, swa, bl, b, ret, push, pop, and mov. It also has an example of using recursion (though only to print a 3N+1 sequence, which could easily be done without recursion). The program test_all.s uses every Lasm instruction. When run, it will print the numbers 1 through 16 in reverse order. The numbers are generated in order and are stored on the stack, then printed at the end.
All of the other test programs use only the 16 basic Larc instructions plus la. I did not write these programs; they came with the original Larc distribution.
You can, of course, write your own test programs. Writing very short test programs that use just a couple instructions could be a good way to test your assembler's code generation for individual instructions.