hello friends and welcome back in this lecture we will talk about programs and the programming languages so here is our outline we will see what our programs and programming languages we will talk about the machine language the assembly language and high-level languages all right so first of all let's define a program and it is also called a software it is basically a set of instructions that tell a computer what to do so we use programs to interact or to talk with computers ok so in order to tell a computer to do something we should use a program ok and to write programs we use programming languages so let's talk about programming languages basically there are languages that are used to write programs as you know computers are machines and they do not understand the human language so programs are written in a language that a computer can understand which is a programming language so to be able to interact with a computer we should write programs using a language that a computer can understand which is a programming language now let's see what do mean by machine language this is the computer's native language so it is the main language of the computer this language uses zeros and ones so the digit 0 and the digit 1 and this is why it is called the binary language binary means two things so as you can see we are using two digits the 0 and the 1 so for example if we want to add two numbers 2 & 3 & get the result we would write something like this this is an instruction written using the machine language it is a group of ones and zeros as you can see and this is only one instruction just to get the sum of 2 and 3 and get the answer which is 5 so as you can see this is very hard to use moreover machine language is machine dependent so it differs among different types of machines so this code over here might work on a certain machine and it might not work on another machine so this is what we mean by machine dependent now let me tell you this every instruction should be written in machine language before it can be executed so later on we're going to write programs using Java so the instructions will be written using the java programming language so all of those instructions must be translated to machine code before we can execute them and this applies to all other programming languages now let's talk about the assembly language it was developed to make programming easier first of all it is also machine dependent and in the assembly language keywords were introduced for example we have a keyword add and a keyword sub and a lot more so programming was a little bit easier for example if you want to add 2 & 3 and get the result we will write something like this this is an assembly instruction we are telling the computer to add the number 2 and the number 3 and to store the result somewhere called a result ok so this is an instruction written in the assembly programming language so this cannot be executed because as we said all instructions should be written in machine code before we execute them so there is a program called assembler that translates assembly code to machine code so let's talk about the assembler suppose that we have this assembly code over here as we said it cannot be executed so this code is given to the assembler and the assembler translates this code to machine code and now this code over here can be executed and this is how we can execute assembly code so whenever we write a program using assembly we will translate it to machine code using the assembler and then we will execute it so now let's talk about high-level languages so high-level languages are a new generation of programming languages in a high-level programming language we use English words so this is why a high-level programming language is easy to learn and easy to use also high-level languages are machine and so our program will run on different machines and this is very important and each instruction written in a high-level programming language is called a statement ok so later on whenever you write an instruction using Java for example we will call it a statement and a program written using a high-level programming language is called a source of program or source code and now let's see this example if we want to add two and a three and get the result we would do something like this in Java this is an instruction written using a high-level programming language so this is a statement and this is very similar to mathematics right we are saying that we want to store inside the result the answer of two plus three so two plus three will be calculated so we get five and five will be stored in the variable result in mathematics we have the concept of a variable right and also in programming we have variable if you don't know what is a variable no problem I'm going to explain it from scratch but for now look at this expression and see how much it is easier than assembly and machine code and look at this semicolon over here basically every instruction or every statement should end with a semicolon and you will see this later on now just like before this is a statement written using a high-level programming language so it cannot be executed we should translate it to machine code and then we can execute it so we can use what's called a compiler or an interpreter in order to translate a source code to machine code and remember source code is a program written using a high level programming language so for example this statement over here is a source code because it is written in our high-level language so let's see how we can translate this statement to machine code using a compiler so basically a compiler translates all the source code into machine code so we have a source program or a source code and we will use a compiler to get an executable and executable is a file that can be executed by our computer so let's have a look we have the source code over here and we use the compiler to generate the machine code and whenever we generate the machine code we can execute it using an executor to see the output or the result so the compiler converts all the source code or all the program to machine code and then we can execute it to see the output now let's have a look at the interpreter it works a little bit different an interpreter translate each statement into machine code and execute set right away so it will not translate all the program it translates each statement at a time so we have something like this we have a statement from a program the interpreter will translate it to machine code and then it will execute it so we will see the output and this over here will be done on all the statements and our program statement by statement but the compiler translates all the program into machine code okay so this is the difference between an interpreter and a compiler so this is it for this video thanks for watching and I'll see you on the next one [Applause] [Music] you [Music]