Anda di halaman 1dari 6

Programming languages can be divided into two major categories: low level and high level.

"Assembly language" and "machine language" are called low-level languages because they more than others "speak" the language the computer understands. On the other hand, C, C++, Pascal, BASIC, Visual Basic, Java, and COBOL are high-level languages because they require more manipulation by the computer, a process called compiling.All computer programs run on machine code that is executed directly on computer architecture. Machine code is not easily read or programmed directly by humans. Essentially, machine code is a long series of bits (i.e. ones and zeroes). In order to program, humans write code in a language that is then translated in to machine code. There are three basic approaches to program translation. * * * Interpreter Assemblers Compilers

Compiler :
A compiler is a special program that processes statements written in a particular programming language and converts them into machine language, a "binary program" or "code," that a computer processor uses. A compiler works with what are sometimes called 3GL and higher-level languages (3rd-generation languages, such as Java, C, and PL/1). Typically, a programmer writes language statements in a language such as C, Pascal, or C++ one line at a time using a tool called an editor. The "edited" file contains the source statements. The programmer then runs the appropriate language compiler (there may be several compilers for each language), specifying the name of the file that contains the source statements.When executing the file, the compiler first parses or analyzes all of the language statements syntactically in a sequential manner and then, in one or more successive passes, builds the output code, ensuring that statements that refer to other statements are referenced correctly in the final code. The code is linked to various libraries, which are common code sections found in many programs. The use of libraries helps keep redundant coding to a minimum. The compilation output is sometimes referred to as object code or an object module. (Note that the term "object" as used in this instance is not related to object-oriented programming. The object code as used here refers to machine code that the processor executes one instruction at a time.) High-level languages are usually compiled and are not limited to any particular computer architecture. High-level languages are much easier to read than assembly language. Compiled languages are preferred by many developers because, once compiled, the program runs faster than if it were interpreted. Once a program has been compiled, it cannot easily be changed, so there's an element of security built in to compiled programs.The Java programming language has taken code compilation one step further. Java, which is used in object-oriented programming, has introduced the idea of compiling output that can run on any computer system platform for which a Java bytecode interpreter (called a Java Virtual Machine) is provided to convert the bytecode into instructions that can be executed by the actual hardware processor. Using this virtual machine, the bytecode can be recompiled at the execution platform by a "just-in-time" compiler. What all this means is that the bytecode is platform-independent code that can be sent to any platform

(Windows, MAC, Unix) and run on that platform. This is one of the principal advantages of Java: write once, compile once. Compiler is a program that translates a computer program written on one computer language to another computer language. A "compiler" is primarily used for programs that translate source code from a high level language to a lower level language (e.g., assembly language or machine language). A program that translates from a low level language to a higher level one is a decompiler. A compiler for a relatively simple language written by one person might be a single, monolithic, piece of software. When the source language is large and complex, and high quality output is required the design may be split into a number of relatively independent phases, or passes. Having separate phases means development can be parceled up into small parts and given to different people. It also becomes much easier to replace a single phase by an improved one, or to insert new phases later.

Compiler characteristics :
spends a lot of time analyzing and processing the program the resulting executable is some form of machine- specific binary code the computer hardware interprets (executes) the resulting code program execution is fast A compiler is also a program which convert the higher level language in lower level language. In case of compiler, it reads a whole block of code at a time, converts it into executable code, and runs the code. The initial start up time to run program is more as compared to Interpreter. Once the code is compiled, then the initial start up time to run the program is negligible. Languages like C, C++ are compiler based languages.

Interpreter :
Interpreters translate code one line at time, executing each line as it is "translated," much the way a foreign language interpreter would translate a book, by translating one line at a time. Interpreters do generate binary code, but that code is never compiled into one program entity. Instead, the binary code is interpreted each and every time the program executes. Some examples of interpreted programs are BASIC, QBASIC, and Visual Basic (version 5 of which has both a compiler and interpreter). Where compiled programs can run on any computer, interpreted programs can only run on computers that also have the interpreter.The Practical Extraction and Reporting Language, or Perl, is a script-based programming language whose syntax parallels that of the C language but is an interpreted language; Perl can optionally be compiled prior to execution into either C code or cross-platform bytecode. Perl is easier to learn and faster to code in than the more structured (and compiled) C and C++ languages. When compiled, a Perl program can execute almost as fast as a fully precompiled C language program. JavaScript is another example of an interpreted script-

based programming language. Interpreters offer programmers some advantages that compilers do not. Interpreted languages are easier to learn than compiled languages, which is great for beginning programmers. An interpreter lets the programmer know immediately when and where problems exist in the code; compiled programs make the programmer wait until the program is complete.There is a third method of generating code, and that's with an assembler, which is used in Assembly language. The assembler translates Assembly language into machine language.Interpreter is a program that translates an instruction into a machine language and executes it before proceeding to the next instruction .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 optimizationA high-level programming language translator that translates and runs the program at the same time. It translates one program statement into machine language, executes it, and then proceeds to the next statement. This differs from regular executable programs that are presented to the computer as binary-coded instructions. Interpreted programs remain in the source language the programmer wrote in, which is human readable text. Interpreted programs run slower than their compiler counterparts. Whereas the compiler translates the entire program before it is run, interpreters translate a line at a time while the program is being run. However, it is very convenient to write an interpreted program, since a single line of code can be tested interactively

Interpreter characteristics :
relatively little time is spent analyzing and processing the program the resulting code is some sort of intermediate code the resulting code is interpreted by another program program execution is relatively slow An Interpreter is a program which converts the higher level language in lower level language or assembly language or binary language i.e. the language of 0s and 1s. It reads one line of code at a time, converts it into binary language and then runs the code on the machine. So the initial start up time to run the program is almost negligible. If there is any error on the middle of the program then the program is interrupted in between. After removing the error the programs needs to run again from the beginning. Languages like BASIC is interpreter based languages. Interpreter converts one line of code at a time, and then runs it

Advantages :
The advantage of interpreters over compilers is that an error is found immediately. So the programmer can make corrections during program development. The advantage of interpreters is that they can execute a program immediately.Interpreters offer programmers some advantages that

compilers do not. Interpreted languages are easier to learn than compiled languages, which is great for beginning programmers. An interpreter lets the programmer know immediately when and where problems exist in the code; compiled programs make the programmer wait until the program is complete.

Disadvantages :
The disadvantage of interpreter is that it is not very efficient. The interpreter does not produce an object program. It must convert the program each time it is executed. Visual basic uses interpreter.

Assembler :
A program that produces executable machine code from symbolic assembly language.An assembler is a program which is used to convert a program written in assembly language into machine language and vice-versa.An assembler is a one type of compiler which compiles the program written in assembly languageAn assembler is a computer program for translating assembly language, basically a mnemonic representation of machine language into object code.Assembler is a programming language processsor that translates an assembly language programe (the source program) to the machine language program (the object program) executable by a computer.An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer's processor can use to perform its basic operations. Some people call these instructions assembler language and others use the term assembly language Most computers come with a specified set of very basic instructions that correspond to the basic machine operations that the computer can perform. For example, a "Load" instruction causes the processor to move a string of bits from a location in the processor's memoryto a special holding place called a register. Assuming the processor has at least eight registers, each numbered, the following instruction would move the value (string of bits of a certain length) at memory location 3000 into the holding place called register 8: The programmer can write a program using a sequence of these assembler instructions. This sequence of assembler instructions, known as the source code or source program, is then specified to the assembler program when that program is started. The assembler program takes each program statement in the source program and generates a corresponding bit stream or pattern (a series of 0's and 1's of a given length). The output of the assembler program is called the object code or object program relative to the input source program. The sequence of 0's and 1's that constitute the object program is sometimes called machine code. The object program can then be run (or executed) whenever desired. In the earliest computers, programmers actually wrote programs in machine code, but assembler languages or instruction sets were soon developed to speed up programming. Today, assembler programming is used only where very efficient control over processor

operations is needed. It requires knowledge of a particular computer's instruction set, however. Historically, most programs have been written in "higher-level" languages such as COBOL, FORTRAN, PL/I, and C. These languages are easier to learn and faster to write programs with than assembler language. The program that processes the source code written in these languages is called a compiler. Like the assembler, a compiler takes higherlevel language statements and reduces them to machine code. Assembler converts machine-manipulation coding directly into binary machine instructions. Produces the most efficient executables, but is the most difficult (for humans) to work withAssemblers create an object code by translating assembly instruction mnemonics into opcodes. They also determine symbolic names for memory locations as well as for other entities. A prime characteristic of assemblers is the use of symbolic references, which saves time consuming manual calculations and address updates after a program has been modified. The majority of assemblers also have macro facilities so that they can perform textual substitution, which means that they are able to create short sequences of instructions.Assembler converts machine-manipulation coding directly into binary machine instructions. Produces the most efficient executables, but is the most difficult (for humans) to work with. Assembler has the capability of processing only the low level assembly language. An Assembler is a computer program that takes computer instructions and converts them into a pattern of bits that the computer can understand and perform by it certain operations It is easier to write an assembler for high level languages than it is to write a compiler, and in fact, they have been around since the 1950s.Assembly languages are more easily translated in to machine code than high-level programs languages. Each assembly language statement directly corresponds to one or more machine instructions. Another way to think about this is that assembly language code is simply an abbreviated form of machine code. Thus, to transform a program from an asembly language to machine code all that must be done is that the instructions must be converted from their mneumonic abbreviations into their equivalent string of ones and zeroes. This transformation process is known as assembling and is accomplished by an assembler.

Difference :
A compiler takes a text file written in a programming language, and converts it into binary code by line: Basic is an interpreter.that a processor can understand: it makes an ".exe" file. You compile only once, then always run the "exe" file. Borland Turbo C is a compiler: you write in C in a text file, then you compile to get and exe file. An interpreter does the same as the compiler, BUT in real time: each time you run the code, it is "compiled", line An assembler is similar, in the way that, instead of taking a plain text file, ie in C, it takes a code written in Assembler Mnemonics, and convert it into binaries. All "executable" files are in binaries (just 1's and 0's) -

REFERENCES :
http://wiki.answers.com

http://answers.yahoo.com

http://sawaal.ibibo.com http://pareshmayani.blogspot.com
http://en.wikipedia.org