In the previous unit, we talked about the assembly process and, and logic in general, and about writing assemblers in general. And in this unit, we will start the journey of actually building an assembler, an assembler that works and that can translate programs from symbolic hack code into binary Hack code. So here is the overall picture in a nutshell. We are given a source program written in symbolic Hack language and we have to translate it into an equivalent program written in binary code. So if you were the person who's supposed to write to develop such an assembler, how would you go about it? And what, what is the knowledge that you have to know in order to develop such a general purpose translator? Because bear in mind, we have to be able to translate any program written in Hack symbolic code, not just the subset of programs but any given program. Well, this is, in general, it's a translation challenge, right? You have to translate from one language, from the source language, to the target language. And in order to do this, you have to know the grammar of both languages. You have to know the syntax rules. For example, if you want to translate from French to Spanish, you have to know the grammatical rules of French in order to take the source sentence and decompose it or parse it into its lingual elements. Then you observe or you inspect these elements. You figure out what is the semantics of this sentence, and then you re-express the semantics in Spanish. And in order to do this, you have to know the rules of the game in Spanish. You have to be able to synthesize a target sentence written in the target language. And that's exactly what we do here. However, when we write translators for programming languages, the task is supremely easier because programming languages are supremely simpler than human spoken languages or natural languages. And in particular, machine languages are are very simple, and therefore the translation task is going to be less formidable as it may seem at the outset. All right, so what do we have to know about the Hack language? Well, the Hack language consists of A-instructions, C-instructions, and symbols. So let us explore every one of these categories very briefly. The A-instruction comes up in in its symbolic syntax. And here is the equivalent binary syntax. And if you want to translate one to the other, I think it doesn't take too much imagination to figure out how to do it. And in any rate, we are going to say it explicitly down the road. The C-instruction in a very similar fashion, has a symbolic syntax and a binary syntax. And there's a set of tables that describe the mapping between the former and the, the latter. And finally the Hack language features symbols. You know, the programmer is invited to use some pre-defined symbols. And also, the programmer is invited to invent symbols of his or her own using the label declaration statement and eth statements or A-instructions that are designed to declare and use variables. So this, basically, you know, this is a complete description of the Hack machine language and given this description, you should be able to develop the desired assembler. So given that we have a program in which all these things that I mentioned before come to play in a, in a vivid example. What exactly do we have here, you know, in terms of general constructs? Well, first of all, we have white space. We haven't mentioned white space in the language specification, we should have. But the white space is almost the same in every language that you can think about. You are welcome to introduce empty lines and comments and in the Hack language, a comment is anything that begins with two slashes. So we have to know how to deal with white space. And then we have a sequence of A-instructions and C-instructions that we have to translate, and finally, we have to deal with the symbols. Symbols come to play either in label declaration commands or in references in the context of A-instructions. So, to make a long story short, if you want to write an assembler, you have to know how to deal with white space, with instructions, and with symbols. Let me say a few words about symbols before we before we go along. I've used red ink in what you see here in order to highlight all the symbols that appear in this program and it's, as you can see, there are quite a few of them. And that's quite characteristic to symbolic machine language programs. They have numerous symbols in them. So the question is, how do we deal with these symbols? Well you know, the answer is that in many cases in life when you face a big mountain in front of your track well, in some cases, you know, the best way to deal with this mountain Is simply to, to bypass it. And that's exactly what I'm going to do with the symbols. I'm going to deal with them later. And by the way, if we are lucky, as we bypass this mountain, we may gain some ground and then summiting the mountain may be easier from the other side than from the original side. And indeed, you will see that when we'll introduce symbols later on in the process, it will be much easier to to morph them, so to speak, into our assembler solution. All right, so symbols later and with that in mind, I now have to deal only with programs that have no symbols. And the assembler that I have to write is much simpler. It's an assembler that deals with symbol-less symbolic Hack programs. So the challenge that remain is to deal with white space and instructions only. And let us begin with white space. Now, what should we do with with white space? Once again, I've used red ink to highlight all the white space in the program. And the easiest way to deal with white space and obviously the most sensible way is to simply ignore it. So as you process the source code whenever you see a comment or an empty line, you simply toss away all this all the contents the follow, that follow in this specific line. And you go on to translate the remaining code. So white space is simply ignored. So what remains after we eliminate eliminate the white space is only instructions. So the challenge is reduced to translating programs that have pure instructions, so to speak, and these are this is a sequence or a stream of A-instructions and C-instructions. And in order to translate them, we have to know how to translate these instructions into binary code. And that's exactly what we are going to do in the next unit. But before we introduce the next unit, I'd like to give you an overall picture of where we're heading from here onward. Well here's the, here's the plan. Since we decided to defer the treatment of symbols to a later stage, we'll begin by writing a basic assembler that can deal with programs that contain no symbols. This will be done in the next unit. In the subsequent unit, we are going to develop the ability to represent, handle, and use symbols. And finally, using this ability, we are going to return to the basic assembler that we wrote before and morph it or extend it into a general purpose assembler that can translate any given program, any given program written in Hack assembly code into binary code. This is the plan. So beginning with the next unit, we're going to talk about how to translate instructions.