Preprocessor: Meaning (information, definition, explanation, facts)

A preprocessor is a program that takes text and performs lexical conversions on it. The conversions may include macro substitution, conditional inclusion, and inclusion of other files.

The C programming language has a preprocessor that performs the following transformations:

  1. Replaces trigraphs with equivalents.
  2. Concatenates source lines.
  3. Replaces comments with whitespace.
  4. Reacts to lines starting with an octothorp (#), performing macro substitution, file inclusion, conditional inclusion, and other transformations.

The use of preprocessors has been getting less common as recent languages provide more abstract features rather than lexical-oriented ones. Indeed, the overuse of the proprecessor might yield quite chaotic code. In designing a new language based on C, Stroustrup introduced features such as inline and templates into C++ in an attempt to make the C preprocessor less relevant.

New languages proposed recently have little or no preprocessor ability. Java has no preprocessor. D, designed as a replacement of C and C++, supports features such as imports, nested functions, versioning, debug statements, etc. that help make it practical to eliminate the preprocessor entirely.

Other preprocessors include m4 and Oracle Pro*C. The m4 preprocessor is general-purpose; Oracle Pro*C converts embedded PL/SQL into C.

Preprocessing can be quite cumbersome in incremental parsing or incremental lexical analysis because changes to preprocessing rules can affect the entire text to be preprocessed.

C Example

A typical example in C is:

#include <stdio.h>

int main (void)
{
    printf("Hello, world!\n");
    return 0;
}

The preprocessor replaces the line #include <stdio.h> with the system header file of that name, which facilitates use of the printf function.

Find more facts
 
Further reference
Remember what Preprocessor means:
Other sources
Search for Preprocessor information on:  amazon.com
Your reference for information, definition
http://explanation-guide.info/meaning/Preprocessor.html
プリプロセッサ
Licensing information:
This article uses material from Wikipedia (credits) and is made available under the terms of the GNU FDL (copy).
Image licensing information is accessible by clicking the image.

Welcome, guest!
You are not logged in
ID:
Password:

Social bookmarks


Book search

Recent searches