Programmers usually make use of high-level languages like C++, Java and Python to write code, which is then translated to machine code by the CPU. Hence, a program written in a high-level language undergoes various phases throughout its lifecycle.
High-level languages are of two types:
1.Compiled Languages (C, C++) - Executed by compilers
Phases
Source code creation
A programmer writes his code in high-level languages
Object file creation
The code that the programmer writes goes to a program called the compiler, which checks it for syntax errors. The compiler then creates a file known as the object file that contains the machine code instructions corresponding to the high-level language.
Executable file creation
Complex programs are usually written in multiple files. A program called the linker takes in the object file and links it to the other relevant files to produce the executable file.
2.Interpreted Languages ( Java, Python ) - Executed by Interpreters
Phases
Source code creation
A programmer writes code in a high-level language of their choice.
Code execution
The code that the programmer writes goes to the interpreter, which goes over it line by line to run it. Unlike a compiler that converts the entire program to machine code at once, an interpreter translates each line (written a high-level language) to machine code and executes it.