Compilers: Object-oriented Programming Language

Topics: Programming language, Java, C Pages: 15 (4020 words) Published: January 29, 2002
Compiler: A Definition

Compiler, in computer science, computer program that translates source code, instructions in a program written by a software engineer, into object code, those same instructions written in a language the computer's central processing unit (CPU) can read and interpret. Software engineers write source code using high level programming languages that people can understand. Computers cannot directly execute source code, but need a compiler to translate these instructions into a low level language called machine code.

Compiler: How It Works

Compilers collect and reorganize (compile) all the instructions in a given set of source code to produce object code. Object code is often the same as or similar to a computer's machine code. If the object code is the same as the machine language, the computer can run the program immediately after the compiler produces its translation. If the object code is not in machine language, other programs—such as assemblers, binders, linkers, and loaders—finish the translation.

Most programming languages—such as C, C++, and Fortran—use compilers, but some—such as BASIC and LISP—use interpreters. An interpreter analyzes and executes each line of source code one-by-one. Interpreters produce initial results faster than compilers, but the source code must be re-interpreted with every use and interpreted languages are usually not as sophisticated as compiled languages.

Most computer languages use different versions of compilers for different types of computers or operating systems; so one language may have different compilers for personal computers (PC) and Apple Macintosh computers. Many different manufacturers often produce versions of the same programming language, so compilers for a language may vary between manufacturers.

Consumer software programs are compiled and translated into machine language before they are sold. Some manufacturers provide source code, but usually only programmers find the source code useful. Thus programs bought off the shelf can be executed, but usually their source code cannot be read or modified.

When executing (running), the compiler first parses (or analyzes) all of the language statements syntactically one after the other and then, in one or more successive stages or "passes", builds the output code, making sure that statements that refer to other statements are referred to correctly in the final code. Traditionally, the output of the compilation has been called object code or sometimes an object module. (Note that the term "object" here is not related to object-oriented programming.) The object code is machine code that the processor can process or "execute" one instruction at a time.

Related Study

More recently, the Java programming language, a language used in object-oriented programming, has introduced the possibility of compiling output (called bytecode) that can run on any computer system platform for which a Java virtual machine or bytecode interpreter is provided to convert the bytecode into instructions that can be executed by the actual hardware processor. Using this virtual machine, the bytecode can optionally be recompiled at the execution platform by a just-in-time compiler. Traditionally in some operating systems, an additional step was required after compilation - that of resolving the relative location of instructions and data when more than one object module was to be run at the same time and they cross-referred to each other's instruction sequences or data. This process was sometimes called linkage editing and the output known as a load module. A compiler works with what are sometimes called 3GL and higher-level languages. An assembler works on programs written using a processor's assembler language.

Computer languages are symbolic systems that computers eventually understand. They help your programs serve your needs. Compilers are programs that help to make this "understanding" happen. While...

Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Object Oriented Programming Essay
  • Object Oriented Programming Essay
  • Essay on Object Oriented Programming Language
  • Object-oriented Programming and Marks Essay
  • Reusability: Object Oriented Programming Essay
  • Object Oriented Programming Midterm Essay
  • Object Oriented Programming in Different Languages Essay
  • Comparison of Object Oriented and Structured Programming Essay

Become a StudyMode Member

Sign Up - It's Free