You are on page 1of 3

ALPRO: Individual Assignment 1

Fanny.Y (6109802)

COMPILER VS INTERPRETER KIND OF PROGRAM EXECUTION


For IT students or to any other programmers, the term compiler and interpreter should be familiar. These two things are quite similiar at a glance, but there are some significant differences when we really look it up. The Distinction
VeryNewbie (2009) echoed in a post that compiler, in a program execution helps

directly rewriting the command weve made in a high level language such as Pascal, C++, BASIC, FORTRAN, Visual Basic, Visual C#, FORTRAN, xBase, or COBOL into a the language our CPU can understand. The rewriting is done all together at a time so itll spends a lot of time to process the code but the exectution part will be relatively fast. A compiler can save its works, so the next time we open the program, it wont be necesarry to rewrite it all over again, thats what will be then called an executable program. Usually the rewritten part is larger than the original program and it will resulting execution in some form of machine code. In another post, Saputra (2009) added that the compiler has another task apart from translating our program, it also checks it to make sure that it is grammatically correct. It wont be able to translate if we made some errors. Once it finds error, itll stop compiling and report the error to you. Bowles(2005) identifies that An interpreter, help translating the command weve made into computer language one line at a time while the program is running. So Itll translate the first line and runs it, then translates the second line and runs it amd so on. 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 again. The time needed to analyze and processing the program will be less than the time needed by a compiler but program execution will be relatively slow. An interpretor will provides color coding to the codes weve written and it will help in self debugging while we were writting a program. An overview about interpreter available on wikipedia says that an interpreted program will be smaller than a compiled program and the resulting code will be an intermediate code, Wikipedia also show some examples of interpreted program languages such as Basic, JavaScript,scheme, APL, Smalltalk and LISP. Nospamy(2006) acknowledge another differences on a posting, on the source code, a compiler wont need the source code to run while an interpreter will surely need the source code since it has no memory like i stated before. A compiler also need two separates
1

ALPRO: Individual Assignment 1

Fanny.Y (6109802)

proccess (linking and parsing) to be able to run the program while an interpreter wont need a seperatable proccess. The Advantages And Disadvantages An overview of the advantages and disadvantages of compiler and interpreters was provided by Bowles(2005) on the WPI-Computer science website. The advantages of compilers are: They execute program faster because the executable program is already translated in a machine language while an interpreter will need to retranslate the program all over again since it doesnt create an executable program. A compiler spot errors while compiling because theyll tell you if they find any errors before you run the program. A compiler can also optimize the code, wether it is to make it faster or to make it smaller. The safety of a compiled program is also more guaranteed since itll used the executable program which is harder to be changed and copied, not like an interpreter which still use its source program which is easier to be changed and copied because its written in a high-language human can understand. While the main advantages of interpreters are : You wont have to wait between writing a program and running it. As soon as you have written a program, you can run it. Interpreted program will also run on a many kind of machines because each machine can have its own interpreter for that language. Not like a compiler which translate all the souce code at a time,an interpreter translate line by line so it wont be necesarry for us to write all the source code completely, thus when theres a mistake occured, we could fix it dirrectly while well need to recompiled our program from the start if theres a mistake. Bowles(2005) acknowledge that some language are both compiled and interpreted, like Python, Java, and Perl. For example, a Java program will need to be compiled to a low-level version and then interpreted to be able to run. So, both compiler and Interpreter has their own advantages and disadvantages. But, to say which is better, It would depends on each of people needs. An interpreter is more suitable to test a smaller program because it will be quite troublesome for a compiler to do the linking and parsing which will definetely took more time for only a small program. While it will be more efficient to compile a bigger program so we wont need to retranslate it everytime we want to execute the program.

ALPRO: Individual Assignment 1

Fanny.Y (6109802)

REFERENCES
Bowles, Richard 2005, 3.1 Compiler vs. Interpreter, WPI Computer Science, viewed 28 August 2010, <http://richardbowles.tripod.com/durham/compilers/compiler.htm> Compiler 2010,Wikipedia, viewed 2 September 2010, <http://en.wikipedia.org/wiki/Compiler> Nospammy 2006, compiler vs interpreter, list server, 08 Juli 2006, viewed 28 August 2010, < http://forum.kafegaul.com/archive/index.php/t-146513.html> TH, Saputra 2009. Teknik Kompilasi, 8 Mei 2010, viewed 28 August 2010, <http://3onoikom.wordpress.com/materi-kuliah/teknik-kompilasi-2> VeryNewbie, 2009, Perbedaan Compiler dan Interpreter , 16 May 2009, viewed 28 August 2010, < http://verynewbie.blogspot.com/2009/05/perbedaan-compiler-daninterpreter.html>

You might also like