Translators:
- Programmer can define only source code.
- We need to convert the source code into binary code before run.
- We use 2 translators to convert Source code into byte code.
- Compiler
- Interpreter
Compiler:
- Compiler checks the source code syntactically correct or not.
- If we define the code correctly, it converts source code into byte code.
- Compiler shows error message with line number if there is a syntax error.
Note: Java programming language use compilation
class Program { public static void main(String[] args) { int a=10; System.out.println(“a val : ” + a); int b=20; System.out.println(“b val : ” + b); System.out.println(“c val : ” + c); } } Compile: Error @ line – 11 (variable “c” not present) |
Interpreter:
- Line by line translation of source code into binary code.
- Python uses interpreter for program execution.
Note: Python programming uses interpretation
a=10 print(“a val :”,a) b=20 print(“b val :”,b) print(“c val :”,c) Output: a val : 10 b val : 20 NameError: name ‘c’ is not defined |