Wednesday, February 9, 2011

What are compilers and interpreters?

In computer programming, interpreters and compilers are very helpful tools that can make programming much ,much easier. What do interpreters and compilers do? They take computer programs which are made from high level languages, and translates them into machine language so the computer can run the program. However, there is a difference between using a compiler and an interpreter. Compilers also create programs that run fast. Compiler's take high level programming language and read it line for line, checking for errors in the grammar. If there is an error in the grammar the compiler will stop and inform the programmer of the mistake and won't right the program until all the grammatical errors are fixed. The disadvantage of this is that just because the compiler checks for grammatical errors, the program isn't necessarily error free. An interpreter writes programs, but writes the program line for line from the language. Interpreters have no memory so it can take a long time for the interpreter to finish if the program has repeating lines of code because it will have to translate those lines freshly every time. The great thing about interpreters is that once a program is written it is ready to run as opposed to waiting for it to compile. You might be asking yourself which is better to use when writing a program for your computer, a compiler or an interpreter? Well its really up to the programmer, but it is a good idea to use both just to increase to compatibility of the program with different computers. It is fairly simple to find compilers and interpreters online, if one was so inclined. Visiting such websites as download.com, or thefreecountry.com you can find numerous compilers for c++ programming and other programming types such as BASIC (beginners all purpose symbolic instruction code), Pascal, and C. Many more sites on the internet provide freeware interpreters and compilers to the public which can be very handy when programming as either a hobby, a job, or just to try it out for fun! Freeware means simply that it is a free program that is available to be downloaded and used by every one for free. If the files were shareware then that would mean the programs are free to use for a trial period, but then must be purchased in order to continue using them. Payware means that the software needs to be purchased before it can be used. It is important to know the difference when downloading programs online that way you can get exactly what you are looking for. No sense in paying for shareware and payware when you can get freeware that will do just as good as anything else. Also it is important to make sure that the interpreters or compilers are used for the language you are trying to translate. You wouldn't want to use a German interpreter for a story that is written in Spanish would you? So be sure to make sure that the compilers and interpreters, or both, are compatible with your code.