Site Loader

The source code (also called source text or short source) of a computer program is the readable text written by the programmer in a programming language. This is in contrast to the executable (executable) code or target code ((s) object code) as generated by a compiler or interpreter from this source code.

JAVA source code example

One also speaks of the source code of a formatted text. An extension is used in such a way that the source result is not displayed when you click on it. An example is an HTML document, which describes the layout of a web page in addition to the content. There is not a readable source code for every formatted document, for example Microsoft Word.

Use of source code from a computer program

The source code can be converted to executable code in a number of ways, allowing the program to run.

  • With a compiler: A compiler converts the source code into machine language so that it can be executed. If the compiler first generates assembly code, the assembler must first translate it to machine language to obtain the executable program. Often the compiler performs additional operations to optimize the executable code, such as omitting dead code, for example variables that do not affect anything later in the code. This is also one of the reasons why compiled code is often faster and more efficient than code executed with an interpreter.
  • With an interpreter: In some cases, the source code can also be executed with an interpreter, a program that reads the source code in real time and immediately executes it. This is usually a lot slower than a compiled program, since each line of code must be processed before it is executed. In practice, modern interpreters first convert the source code into an internal representation, which is also a form of compiling, and then execute this internal representation of the program.
  • With a separate virtual machine (VM). Many modern programming languages, such as C#, Java, Perl 6 and Scala, usually use a mixed form: the source code is first compiled into an intermediate language (bytecode, P-code or ‘managed code’ MSIL), which is then used by a separate virtual machine interpreted. Some advantages of this construction are:
    • The compiled code is platform independent.
    • At the time of execution, the interpreter can still perform certain checks and operations, such as the sandbox security of Java applets and an optimization of performance.

There is also a construction where the source code is translated into another higher language. For example, in the language PL / SQL, where the universal PL / SQL compiler translates the source code into a C code (stripped of object-oriented code but provided with ’embedded SQL’), which is automatically translated again by a ‘native’ C compiler to an optimal machine code.

Source code

Post Author: admin1432