Try the new Google Books Show
Índice
Check out the new look and enjoy easier access to your favorite features 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. What is Interpreter?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.
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 In order to continue enjoying our site, we ask that you confirm your identity as a human. Thank you very much for your cooperation. Computers only understand machine code (binary), this is an issue because programmers prefer to use a variety of high and low-level programming languages instead. To get around the issue, the high-level and low-level program code (source code) needs to pass through a translator. A translator will convert the source code into machine code (object code). There are several types of translator programs, each able to perform different tasks. CompilerCompilers are used to translate a program written in a high-level language into machine code (object code). Once compiled (all in one go), the translated program file can then be directly used by the computer and is independently executable. Compiling may take some time but the translated program can be used again and again without the need for recompilation. An error report is often produced after the full program has been translated. Errors in the program code may cause a computer to crash. These errors can only be fixed by changing the original source code and compiling the program again. If you need to learn more about high-level languages, visit our Languages page. InterpreterInterpreter programs are able to read, translate and execute one statement at a time from a high-level language program. The interpreter stops when a line of code is reached that contains an error. Interpreters are often used during the development of a program. They make debugging easier as each line of code is analysed and checked before execution. Interpreted programs will launch immediately, but your program may run slower then a complied file. No executable file is produced. The program is interpreted again from scratch every time you launch it. If you need to learn more about high-level languages, visit our Languages page. AssemblerAssemblers are used to translate a program written in a low-level assembly language into a machine code (object code) file so it can be used and executed by the computer. Once assembled, the program file can be used again and again without re-assembly. If you need to learn more about low-level languages, visit our Languages page. Summary of translators
Related TheoryRelated Quizzes
Which is the software that translates and executes a highThe language processor that reads the complete source program written in high-level language as a whole in one go and translates it into an equivalent program in machine language is called a Compiler.
What translates and executes highInterpreter translates and executes program at run time line by line.. an interpreter is a computer program that directly executes, i.e. performs, instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program.. What do you call a program that translates highTo execute a program in a high-level language, it can be compiled or interpreted. A compiler translates the entire program written in a high-level language to machine language prior to execution. An interpreter translates a program line by line during execution.
What is translate and execute program at run time line by line?Answer. Answer: Interpreter translates and executes program at run time line by line. an interpreter is a computer program that directly executes, i.e. performs, instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program.
|