

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Detailed informtion about Compiler vs. Interpreter, Compiler characteristics, Interpreter characteristics, advantages, high-level language, Basic program.
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!
3.1 Compiler vs. Interpreter An interpreter translates some form of source code into a target representation that it can immediately execute and evaluate. The structure of the interpreter is similar to that of a compiler, but the amount of time it takes to produce the executable representation will vary as will the amount of optimization. The following diagram shows one representation of the differences.
Compiler characteristics:
An interpreter is also a program that translates a high-level language into a low- level one, but it does it at the moment the program is run. You write the program using a text editor or something similar, and then instruct the interpreter to run the program. It takes the program, one line at a time, and translates each line before running it: It translates the first line and runs it, then translates the second line and runs it etc. The interpreter has no "memory" for the translated lines, so if it comes across lines of the program within a loop, it must translate them afresh every time that particular line runs. Consider this simple Basic program: 10 FOR COUNT = 1 TO 1000 20 PRINT COUNT * COUNT 30 NEXT COUNT
Line 20 of the program displays the square of the value stored in COUNT and this
line has to be carried out 1000 times. The interpreter must also translate that line 1000 times, which is clearly an inefficient process. However, interpreted languages do have their uses, as we will see in a later section.
Examples of interpreted languages are Basic, JavaScript and LISP.
Well, that depends on how you want to write and run your program. The main advantages of compilers are as follows:
The main advantages of interpreters are as follows: