Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
CO5570 Anonymous Questions and Answers Page (2021, 1-14) XML CO5570 Anonymous Questions and Answers This page lists the various questions and answers. To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers. We have taken the liberty of making some minor typographical corrections to some of the questions as originally put. Although most of the questions here will have been submitted anonymously, this page also serves to answer some questions of general interest to those on the course. Question 14: Submission reference: IN1885 My error for incorrect file usage prints: "Usage: python3 assembler.py file.shk" is this allowed? Answer 14: No, because it doesn't match what the spec requires. Question 13: Submission reference: IN1884 In the brief it states "A ROM label that has not been defined used as the destination of a jump instruction must be reported." This results in the following error message being printed: "Instruction label xyz has not been defined." Because the brief states its about jump instructions, what about labels that aren't declared in RAM or ROM and used in instructions other than jump ones? Should I just output the same 'Instruction label has not been defined error'? That is what I do currently. Thanks Answer 13: ROM labels are only valid in jump instructions and nowhere else, so use of an undeclared label in any other type of instruction would count as an undeclared RAM label. Question 12: Submission reference: IN1880 So for missing label definitions (both missing from the .dec section and from the .code section), my code outputs RAM label errors as they come and at the end those labels are also missing from the ROM labels list, so my errors are printed like so RAM label mno has not been declared RAM label xyz has not been declared RAM label abc has not been declared Instruction label abc has not been defined Instruction label mno has not been defined Instruction label xyz has not been defined Is this fine? This question is going off what I explained in Question 10 (2021). Thank you Answer 12: Yes, that is right. Just for context for those not reading the preceding question question, in this particular case the same set of labels were - incorrectly - used for both RAM and ROM labels but none were declared/defined. Question 11: Submission reference: IN1879 Dear David I wanna ask about ASS3, i have read whole assignment brief, but I don't see the tasks we need to do? Can you please post questions? Answer 11: You have to write a program (from scratch) that can read source files containing text like the examples given in the brief: .dec sum x y .code LOAD D x ADDD y STO D sum start: loop: LOAD D x ADDD y STO D sum JMP loop and convert them into the equivalent Hack code. How to convert each Shack instruction is given in the tables in the brief. Question 10: Submission reference: IN1869 If the assembler comes across a label that it cannot find in a list for ROM labels and it can't find it in the RAM labels list, then the error it would print would be that there is an 'undeclared RAM label xyz', but if xyz comes up later in the .shk file as a ROM label declaration, then that previous error is incorrect. But how would I know if it is a undeclared ROM label as opposed to an undeclared RAM label if missing declarations for ROM labels are shown at the end, while missing declarations for RAM labels are printed as they come? What way should I show the labels Answer 10: The assembler does not need to either look ahead or retrospectively re-evaluate previous decisions, so it should report on the basis of what it knows at the point it finds an error. Referrers: Question 12 (2021) Question 9: Submission reference: IN1867 Just so I understand, but if an error occurs for any reason, operand, opcode or RAM/ROM label undeclared, etc, then I shouldn't process that line and should then simply proceed to the next line? Answer 9: Exactly. Question 8: Submission reference: IN1865 When I declare RAM labels in the .dec section and when I declare ROM labels in the .code section, what error should I print if they are not the right alphanumeric + underscore + starts with letter format? Answer 8: If they contain an illegal character then use the illegal character error. Question 7: Submission reference: IN1862 If an illegal opcode is detected then I should stop processing the current line, otherwise how would you detect an illegal operand when the opcode isn't right? So in that case only an illegal opcode message would be printed correct? Answer 7: As soon as you find a single error just report it and ignore any further processing of the line. Question 6: Submission reference: IN1856 For assignment 3, what is the Python equivalent of Java's System.err that I should use to write errors to? Answer 6: I get to teach Python now! A Google search for python error stream yields: How to print to stderr in Python. Question 5: Submission reference: IN1853 Is it best to read a line, process it and write the line the repeat - or is it best to read it, process it, store it and then translate/write the output file in one go? Answer 5: You can process and translate each line independently so I would recommend the first option. Question 4: Submission reference: IN1848 I am a stupid question about Ass3, I have read the file you give to us, but when is the task we need to start, I can not find it to start. (I have vision 22rd, 25th) Answer 4: I am not sure if you are asking When or What, but the When is now - 'Date set: 22nd November 2021.' - and the What is 'You will write an assembler for a low-level language called Shack (Simplified Hack).' The Shack language is described in the rest of the document and there is nothing else you should need to be able to start on the task. Keywords: assign3 Question 3: Submission reference: IN1837 Will you provide some sample Shack inputs for Assignment 3? Answer 3: Yes I will, although the assignment brief already contains one example for every instruction, so you should also be able to put a few of those together in random orderings and add your own variations. Keywords: assign3 Question 2: Submission reference: IN1822 can I follow the book to complete the assignment? Answer 2: Yes, if you wish, but you will need to bear in mind that the assignment is different from the book's projects. Keywords: assign3 Question 1: Submission reference: IN6498 Sample question. Answer 1: Sample answer. This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. Last modified Thu Feb 10 09:13:46 2022 This document is maintained by David Barnes, to whom any comments and corrections should be addressed.