If you just use the parsing tools of some language, then you rob yourself of a significant objective of the project which is to learn and understand how to parse a language.
For the assembler the task is very easy since each line is its own instruction. On top of that, each C-type instruction consists of four independent pieces. The first is just because it IS a C-type instruction while the remaining three match directly to the three possible parts of such an instruction.
If you don't spend the time to learn how to do this yourself, you will be completely lost when it comes time to parse the Jack language. If you just use someone else's parsing routines, then what's the point of doing it at all?
Hi. Could you clarify for me what to put on the symbol table. We have a partial .asm code here:
0;JMP // goto output_d
D=M // D = first number
I understood that in an @variable, the value should start at 16. If OUTPUT_D is the first @variable, its value should be 16. But what value should I put in for (OUTPUT_D)? 16, or the position of its line? Thank you.
If a label is used in an A-type instruction and this is then followed by a jump that is executed, code execution should continue with the first instruction in the code following where the label was defined.
So the value associated with a label must be the ROM address of the first instruction following the label definition.
Is there a blank space at the end of each line? If so, try removing that and see what happens.
Another possibility is that the text encoding that is being produced is Unicode and not ASCII.
How many lines are in the .hack file? How big, in bytes, is the file. If you are on a Windows platform then it should be right at 18 times the number of lines. If you are on a Mac or Linux box then it should be about 17 times that number. If you are getting close to twice that size, then it is probably using basic Unicode.
Never mind. I used another program similar to Notepad. Sublime is a better alternative. I have just finished Part 1 of the Nand2tetris course and received a certificate from Coursera.
I am still thinking of either going to Nand2tetris Part 2, MIT's Discrete Math (not an online course, but they have an online library where I can go to), or Stanford's Algorithm class also in Coursera. I am confused at this point. How would you order the classes to take, or what can be taken at the same time?
I don't see any conflicts between the N2T Part 2 and anything else and there's something to be said for pushing on while Part 1 is fresh in your mind.
I don't know about the Algorithms course and whether it might benefit from having Discrete Math first. But probably not very much, so I don't think the order you take them in matters and you could likely take them all at the same time provided that would be too much of a workload for you.