I read every where that we write source code (High level language), the compilers converts it into a machine code (Low level language). Then i read that there is an assembler, which converts assembly code into a machine code. Then When differentiating compiler and interpreter, i read that compiler first converts whole code into object code while interpreter directly converts into machine code by skipping object code. Now i have confusions and i got the following questions in mind:
- From where the assembly code comes out, if compilers directly converts source code into machine code?
- What is difference between object code and machine code?
- Who converts source code to assembly code?
- What is high level and low level language, how to differentiate them?
- Assembly code and object code are high level or low level?
All apart from source code are low-level languages.
I believe object and machine code refer to the same thing.
There is no direct conversion from source to assembly code as source code is generally converted directly to machine code. An assembler can be used to convert assembly code to machine code (assembly language has a 1:1 correspondence with machine code). A compiler is used to convert source code directly into machine code.
Assemblers are used because, as machine code is different for each type of computer, assembly languages are also specific to each type of computer.
A high-level language is one where we use abstract low-level languages into easy-to-read-and-understand code. It is an abstraction to help us be more productive whilst coding.
A low-level language is one where there is little or no abstraction from a computer's instruction set.