I have a project that I have to make a parser in C (first milestone) that it read an assembly file, e.g
goto:
goto:
L.D F0,0(R1) #### comments
ADD.D F4,F0,F2 #### more comments
S.D 0(R1),F4 ###
DSUBUI R1,R1,8 ####
BNEZ R1,goto
L.D F0 0X00A0100
MAYBE 10000 instructions (after that…)
I am thinking of doing this by using arrays….is there a better way of doing this? Also I have to simulate Tomasulo’s algorithm using the commands I read from the file.
You’re unlikely to get much help here with such a general question.
There are existing MIPS assemblers that do parsing which might provide you with some ideas, or at least some better questions:
http://code.google.com/p/mips-assembler-unb/source/browse/trunk/src/MIPS+Assembler/
…but clearly you’ll be setting yourself up for a world of pain if you try using anything like that directly for a class project!
The best source for guidance if you’re going to be graded will come from the person who’s going to end up giving out the grade. Admit your confusion and ask for help directly. But go with a very clear map of what you did understand, and the point where your understanding stopped.
(This question doesn’t demonstrate that kind of clarity, and your teacher will probably be unenthusiastic—much like the community here—if you put it to them in the same way.)