A compiler is a computer program that transforms code written in a high-level programming language into the machine code. It is a program which translates the human-readable code to a language a computer processor understands (binary 1 and 0 bits). The computer processes the machine code to perform the corresponding tasks. A compiler should comply with the syntax rule of that programming language in which
it is written. However, the compiler is only a program and can not fix errors found in that program. So, if you make a mistake, you need to make changes in the syntax of your program. Otherwise, it will not compile. An interpreter is a computer program, which converts each high-level program statement into the machine code. This includes source code, pre-compiled code, and scripts. Both compiler and interpreters do the same job which is converting higher level
programming language to machine code. However, a compiler will convert the code into machine code (create an exe) before program run. Interpreters convert code into machine code when the program is run. KEY DIFFERENCE
Difference Between Compiler and Interpreter
Role of Compiler
Also Check:- Compiler Design Tutorial for Beginners Role of Interpreter
HIGH-LEVEL LANGUAGESHigh-level languages, like C, C++, JAVA, etc., are very near to English. It makes programming process easy. However, it must be translated into machine language before execution. This translation process is either conducted by either a compiler or an interpreter. Also known as source code. MACHINE CODEMachine languages are very close to the hardware. Every computer has its machine language. A machine language programs are made up of series of binary pattern. (Eg. 110110) It represents the simple operations which should be performed by the computer. Machine language programs are executable so that they can be run directly. OBJECT CODEOn compilation of source code, the machine code generated for different processors like Intel, AMD, and ARM is different. To make code portable, the source code is first converted to Object Code. It is an intermediary code (similar to machine code) that no processor will understand. At run time, the object code is converted to the machine code of the underlying platform. Java is both Compiled and Interpreted.To exploit relative advantages of compilers are interpreters some programming language like Java are both compiled and interpreted. The Java code itself is compiled into Object Code. At run time, the JVM interprets the Object code into machine code of the target computer. Also Check:- Java Tutorial for Beginners: Learn Core Java Programming Which translator translate a highA compiler is a translator program which translates a high level programming language into equivalent machine language programs.
Which converts a highThe name compiler is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language, object code, or machine code) to create an executable program.
What program translates computer language to machine language?A compiler is a program that translates computer code written in one high programming language into machine-language or code that can be understood by a digital computer's CPU.
|