Compiler


 * ​Compilers**

=__Technical Information__=

//What it is//
Compiler: a computer program that translates a program in a high level language (eg. Java, C++) into a language the computer can understand, machine language (binary)

//How they work//



 * 1) Source code is compiled into object code
 * 2) Object code is combined with library files by a linker
 * 3) Produces the file that can be executed by the computer (executable file)

Library files are object codes already compiled that provide operations that many computers use repeatedly.

When you compile code, there is the lexical analysis and the syntactical analysis. The lexical analysis changes the source code into lexical toxens. These lexical tokens are then put through the syntactical analysis, where the grammar rules decide whether the input is valid or not.

There are two types of errors in compiling; there are syntax and logical errors. Syntax errors are like spelling errors; the limit the compiler's understanding of the program, whereas logical errors are like grammatical errors; these are errors in the way the program functions.

Here is a video to further explain the topic. media type="youtube" key="0yzUGqH5oKw" height="344" width="425"

Types
There are many computer programming languages that use compilers, such as: There are other, more complex forms of compilers, including cross compilers and the compilers built for Java.
 * COBOL
 * C++
 * FORTRAN
 * C
 * Pascal

//Cross Compilers//
Cross compilers have been created for years now. These are devices that are able of developing an executable format on many kinds of platforms (computer system that runs application programs). This compiler also helps create a working network between any machine, no matter its operating system. Cross-compilers allow important files to be accessed from various types of computers on a common server. Cross compilers can also perform many other functions. Microcontrollers are an example; cross compilers direct the tasks of the microcontrollers, allow the microcontrollers to store more information.

//Java//
Java is one of the most popular computer programming languages in the world in the 1990s because it is easier to understand and the Internet uses this programming, which make it more convienent. Usually many of the computer programming languages are either interpreters or compilers, however Java is actually a combination. When a programmer saves and creates a Java file (which is being saved on a .java extension), the program needs to be translated, so the programmer will compile the file. However when the file is compiled, it is not fully translated into machine code, designed specifically for a particular type of computer. As a by-product we receive byte-code (has a .class extension), which is not only allows one specific type of computer to read the byte-code, it can be read by any computer with the interpreter installed. Then, the Java interpreter on one's computer (that is sometimes called the Java Virtual Machine) translates the program from a .class file to binary or any more computer understandable language.

The reason for such a complicated process is to make the code language for Java more portable to use on any type of computer: once the Java file has been compiled on one computer, it is just as easy to interpret it on another.

These are some of the main types of compilers in Java, such as:
 * 1) Javac
 * 2) GCJ
 * 3) Jikes
 * 4) Excelsior JET
 * 5) ECJ

//Interpreter: What is it? (a brief definition)//
First of all, an interpreter is high-level computer program translator, similar to the compiler, that translates and executes the program at the SAME time. The programs that use interpreter still stay in the source code the programmer can understand (a human readable text). Examples of computer languages that use this translator are: Perl, PH P, Ruby, Python, etc.

//Compiler v.s. Interpreter//
Even though the compilers and interpreters are similar, as well as their functions, there are a some distinct differences between these two computers programs, such as:
 * Interpreters are saved on the same format, while a compiler is used on a executable format.
 * Interpreters are slower to run on because the computer always has to convert the file to machine code (binary) every time the programmer wants to run their program, while with a compiler the program has already been converted into machine code.
 * However it takes a longer time for a compiler to analyze and process the code between writing and running the code, before it compiles the code.
 * Compilers can detect and sometimes correct any syntax (grammatical) mistakes; this does not imply it does this all the time.
 * Interpreters can run on a variety of kinds of machines because each machine each have interpreters inside its machine.
 * Interpreter can change itself by modifying or adding functions by the run time, which a compiler cannot do.

This displays the process the compiler, the interpreter and the combination of both must go through so that we could obtain, for example a computer game, such as World of War Craft. =__History__=

The history of compilers is a somewhat undescriptive, however successful story, which began in the 1950's. At first there were experimental attempts to making the compiler,until one was successful in 1952. It was created by the seminal work of Grace Hopper, who was a part of the A-O language team. However, the most accredited compiler known is the one created in 1957, created by the FORTRAN computer programmer team. In 1960, the COLBOL computer programming team was one of the earliest languages to be compiled on multiple designs of computer system. In 1962, Mart and Levin for the Lisp at MIT computer programming team created the first compiler to translate from the source code in a high-level language to binary (because originally early versions were written in assembly language, a low-level language). In 1970s the PL/O compiler which was originally used for teaching the construction of the compiler by Niklaus Wirth has introduced a few concepts, which have been now established by educational standards, such as, The use of Program Development by Stepwise Refinement. During the 1960s and 1970s compilers have been becoming increasingly more advanced. Early versions of compilers were written in assembly language, however as technology developed, compilers have been designed so that they could be written in higher level languages. In addition, early versions of compilers were called "one-pass"compilers that were used for early computer programming languages, such as Pascal. They are compilers that only pass the source code once; they are faster however they do not generate as an efficient program. Now that more advanced compilers have been invented, we now have "multi-pass" compilers that we use nowadays. This means that the compiler goes through three stages (click here). These compilers are slower but they are are a more effiecient program, that can translate all sorts of source codes.

And as over the years, more advanced compilers have been developed due to the fact more people are more interested in them because compilers are now easier to maneuver, thanks to our great desire to create better technology for others! =__Quiz__= Here is a quiz to test your knowledge.

=__References__​=

@http://www.wisegeek.com/what-is-a-compiler.htm @http://cplus.about.com/od/introductiontoprogramming/p/compiler.htm @http://www.coronadoenterprises.com/tutorials/cpp/cpp_ans.html @http://www.experiencefestival.com/a/Compiler_-_History/id/1248959 __[] @http://www.vanguardsw.com/DpHelp4/dph00296.htm @http://www.pcmag.com/encyclopedia_term/0,2542,t=compiler&i=40105,00.asp [] [] [] [] [] [] [] [] []__