<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
preprocessor	B-Application
(	O
or	O
precompiler	B-Application
)	O
is	O
a	O
program	B-Application
that	O
processes	O
its	O
input	O
data	O
to	O
produce	O
output	O
that	O
is	O
used	O
as	O
input	O
in	O
another	O
program	B-Application
.	O
</s>
<s>
The	O
output	O
is	O
said	O
to	O
be	O
a	O
preprocessed	O
form	O
of	O
the	O
input	O
data	O
,	O
which	O
is	O
often	O
used	O
by	O
some	O
subsequent	O
programs	O
like	O
compilers	B-Language
.	O
</s>
<s>
The	O
amount	O
and	O
kind	O
of	O
processing	O
done	O
depends	O
on	O
the	O
nature	O
of	O
the	O
preprocessor	B-Application
;	O
some	O
preprocessors	B-Application
are	O
only	O
capable	O
of	O
performing	O
relatively	O
simple	O
textual	O
substitutions	O
and	O
macro	O
expansions	O
,	O
while	O
others	O
have	O
the	O
power	O
of	O
full-fledged	O
programming	O
languages	O
.	O
</s>
<s>
A	O
common	O
example	O
from	O
computer	B-General_Concept
programming	I-General_Concept
is	O
the	O
processing	O
performed	O
on	O
source	O
code	O
before	O
the	O
next	O
step	O
of	O
compilation	B-Language
.	O
</s>
<s>
In	O
some	O
computer	B-Language
languages	I-Language
(	O
e.g.	O
,	O
C	B-Language
and	O
PL/I	B-Language
)	O
there	O
is	O
a	O
phase	O
of	O
translation	B-Language
known	O
as	O
preprocessing	O
.	O
</s>
<s>
Lexical	O
preprocessors	B-Application
are	O
the	O
lowest-level	O
of	O
preprocessors	B-Application
as	O
they	O
only	O
require	O
lexical	B-Application
analysis	I-Application
,	O
that	O
is	O
,	O
they	O
operate	O
on	O
the	O
source	O
text	O
,	O
prior	O
to	O
any	O
parsing	B-Language
,	O
by	O
performing	O
simple	O
substitution	O
of	O
tokenized	B-Application
character	O
sequences	O
for	O
other	O
tokenized	B-Application
character	O
sequences	O
,	O
according	O
to	O
user-defined	O
rules	O
.	O
</s>
<s>
They	O
typically	O
perform	O
macro	O
substitution	O
,	O
textual	B-Language
inclusion	I-Language
of	O
other	O
files	O
,	O
and	O
conditional	B-Application
compilation	I-Application
or	O
inclusion	O
.	O
</s>
<s>
The	O
most	O
common	O
example	O
of	O
this	O
is	O
the	O
C	B-Language
preprocessor	I-Language
,	O
which	O
takes	O
lines	O
beginning	O
with	O
'	O
#	O
 '	O
as	O
directives	O
.	O
</s>
<s>
The	O
C	B-Language
preprocessor	I-Language
does	O
not	O
expect	O
its	O
input	O
to	O
use	O
the	O
syntax	O
of	O
the	O
C	B-Language
language	I-Language
.	O
</s>
<s>
Instead	O
of	O
macros	O
,	O
some	O
languages	O
use	O
aggressive	O
inlining	O
and	O
templates	B-Language
.	O
</s>
<s>
Instead	O
of	O
includes	O
,	O
some	O
languages	O
use	O
compile-time	O
imports	O
that	O
rely	O
on	O
type	O
information	O
in	O
the	O
object	O
code	O
.	O
</s>
<s>
Some	O
languages	O
use	O
if-then-else	O
and	O
dead	O
code	O
elimination	O
to	O
achieve	O
conditional	B-Application
compilation	I-Application
.	O
</s>
<s>
Other	O
lexical	O
preprocessors	B-Application
include	O
the	O
general-purpose	O
m4	B-Device
,	O
most	O
commonly	O
used	O
in	O
cross-platform	O
build	O
systems	O
such	O
as	O
autoconf	B-Application
,	O
and	O
GEMA	B-Application
,	O
an	O
open	O
source	O
macro	B-Application
processor	I-Application
which	O
operates	O
on	O
patterns	O
of	O
context	O
.	O
</s>
<s>
Syntactic	O
preprocessors	B-Application
were	O
introduced	O
with	O
the	O
Lisp	B-Language
family	O
of	O
languages	O
.	O
</s>
<s>
For	O
some	O
programming	O
languages	O
,	O
the	O
rules	O
are	O
written	O
in	O
the	O
same	O
language	O
as	O
the	O
program	B-Application
(	O
compile-time	O
reflection	O
)	O
.	O
</s>
<s>
This	O
is	O
the	O
case	O
with	O
Lisp	B-Language
and	O
OCaml	B-Language
.	O
</s>
<s>
Some	O
other	O
languages	O
rely	O
on	O
a	O
fully	O
external	O
language	O
to	O
define	O
the	O
transformations	O
,	O
such	O
as	O
the	O
XSLT	B-Application
preprocessor	B-Application
for	O
XML	B-Protocol
,	O
or	O
its	O
statically	O
typed	O
counterpart	O
CDuce	B-Language
.	O
</s>
<s>
Syntactic	O
preprocessors	B-Application
are	O
typically	O
used	O
to	O
customize	O
the	O
syntax	O
of	O
a	O
language	O
,	O
extend	O
a	O
language	O
by	O
adding	O
new	O
primitives	O
,	O
or	O
embed	O
a	O
domain-specific	B-Language
programming	I-Language
language	I-Language
(	O
DSL	O
)	O
inside	O
a	O
general	O
purpose	O
language	O
.	O
</s>
<s>
A	O
good	O
example	O
of	O
syntax	O
customization	O
is	O
the	O
existence	O
of	O
two	O
different	O
syntaxes	O
in	O
the	O
Objective	B-Language
Caml	I-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
Similarly	O
,	O
a	O
number	O
of	O
programs	O
written	O
in	O
OCaml	B-Language
customize	O
the	O
syntax	O
of	O
the	O
language	O
by	O
the	O
addition	O
of	O
new	O
operators	O
.	O
</s>
<s>
The	O
best	O
examples	O
of	O
language	O
extension	O
through	O
macros	O
are	O
found	O
in	O
the	O
Lisp	B-Language
family	O
of	O
languages	O
.	O
</s>
<s>
While	O
the	O
languages	O
,	O
by	O
themselves	O
,	O
are	O
simple	O
dynamically	O
typed	O
functional	O
cores	O
,	O
the	O
standard	O
distributions	O
of	O
Scheme	B-Language
or	O
Common	B-Language
Lisp	I-Language
permit	O
imperative	O
or	O
object-oriented	O
programming	O
,	O
as	O
well	O
as	O
static	O
typing	O
.	O
</s>
<s>
Almost	O
all	O
of	O
these	O
features	O
are	O
implemented	O
by	O
syntactic	O
preprocessing	O
,	O
although	O
it	O
bears	O
noting	O
that	O
the	O
"	O
macro	O
expansion	O
"	O
phase	O
of	O
compilation	B-Language
is	O
handled	O
by	O
the	O
compiler	B-Language
in	O
Lisp	B-Language
.	O
</s>
<s>
This	O
can	O
still	O
be	O
considered	O
a	O
form	O
of	O
preprocessing	O
,	O
since	O
it	O
takes	O
place	O
before	O
other	O
phases	O
of	O
compilation	B-Language
.	O
</s>
<s>
One	O
of	O
the	O
unusual	O
features	O
of	O
the	O
Lisp	B-Language
family	O
of	O
languages	O
is	O
the	O
possibility	O
of	O
using	O
macros	O
to	O
create	O
an	O
internal	O
DSL	O
.	O
</s>
<s>
Typically	O
,	O
in	O
a	O
large	O
Lisp-based	O
project	O
,	O
a	O
module	O
may	O
be	O
written	O
in	O
a	O
variety	O
of	O
such	O
minilanguages	B-Language
,	O
one	O
perhaps	O
using	O
a	O
SQL-based	O
dialect	O
of	O
Lisp	B-Language
,	O
another	O
written	O
in	O
a	O
dialect	O
specialized	O
for	O
GUIs	B-Application
or	O
pretty-printing	O
,	O
etc	O
.	O
</s>
<s>
Common	B-Language
Lisp	I-Language
's	O
standard	O
library	O
contains	O
an	O
example	O
of	O
this	O
level	O
of	O
syntactic	O
abstraction	O
in	O
the	O
form	O
of	O
the	O
LOOP	O
macro	O
,	O
which	O
implements	O
an	O
Algol-like	O
minilanguage	B-Language
to	O
describe	O
complex	O
iteration	O
,	O
while	O
still	O
enabling	O
the	O
use	O
of	O
standard	O
Lisp	B-Language
operators	O
.	O
</s>
<s>
The	O
MetaOCaml	O
preprocessor/language	O
provides	O
similar	O
features	O
for	O
external	O
DSLs	O
.	O
</s>
<s>
This	O
preprocessor	B-Application
takes	O
the	O
description	O
of	O
the	O
semantics	O
of	O
a	O
language	O
(	O
i.e.	O
</s>
<s>
an	O
interpreter	O
)	O
and	O
,	O
by	O
combining	O
compile-time	O
interpretation	O
and	O
code	O
generation	O
,	O
turns	O
that	O
definition	O
into	O
a	O
compiler	B-Language
to	O
the	O
OCaml	B-Language
programming	I-Language
language	I-Language
—	O
and	O
from	O
that	O
language	O
,	O
either	O
to	O
bytecode	O
or	O
to	O
native	O
code	O
.	O
</s>
<s>
Most	O
preprocessors	B-Application
are	O
specific	O
to	O
a	O
particular	O
data	O
processing	O
task	O
(	O
e.g.	O
,	O
compiling	B-Language
the	O
C	B-Language
language	I-Language
)	O
.	O
</s>
<s>
A	O
preprocessor	B-Application
may	O
be	O
promoted	O
as	O
being	O
general	O
purpose	O
,	O
meaning	O
that	O
it	O
is	O
not	O
aimed	O
at	O
a	O
specific	O
usage	O
or	O
programming	O
language	O
,	O
and	O
is	O
intended	O
to	O
be	O
used	O
for	O
a	O
wide	O
variety	O
of	O
text	O
processing	O
tasks	O
.	O
</s>
<s>
M4	B-Device
is	O
probably	O
the	O
most	O
well	O
known	O
example	O
of	O
such	O
a	O
general	B-Application
purpose	I-Application
preprocessor	I-Application
,	O
although	O
the	O
C	B-Language
preprocessor	I-Language
is	O
sometimes	O
used	O
in	O
a	O
non-C	O
specific	O
role	O
.	O
</s>
<s>
using	O
C	B-Language
preprocessor	I-Language
for	O
JavaScript	B-Language
preprocessing	O
.	O
</s>
<s>
using	O
C	B-Language
preprocessor	I-Language
for	O
devicetree	B-Operating_System
processing	O
within	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
.	O
</s>
<s>
using	O
M4	B-Device
(	O
see	O
on-article	O
example	O
)	O
or	O
C	B-Language
preprocessor	I-Language
as	O
a	O
template	B-Application
engine	I-Application
,	O
to	O
HTML	B-Language
generation	O
.	O
</s>
<s>
imake	B-Application
,	O
a	O
make	B-Application
interface	O
using	O
the	O
C	B-Language
preprocessor	I-Language
,	O
written	O
for	O
the	O
X	B-Operating_System
Window	I-Operating_System
System	I-Operating_System
but	O
now	O
deprecated	O
in	O
favour	O
of	O
automake	B-Application
.	O
</s>
<s>
grompp	O
,	O
a	O
preprocessor	B-Application
for	O
simulation	O
input	O
files	O
for	O
GROMACS	B-Application
(	O
a	O
fast	O
,	O
free	O
,	O
open-source	O
code	O
for	O
some	O
problems	O
in	O
computational	O
chemistry	O
)	O
which	O
calls	O
the	O
system	O
C	B-Language
preprocessor	I-Language
(	O
or	O
other	O
preprocessor	B-Application
as	O
determined	O
by	O
the	O
simulation	O
input	O
file	O
)	O
to	O
parse	O
the	O
topology	O
,	O
using	O
mostly	O
the	O
#define	O
and	O
#include	O
mechanisms	O
to	O
determine	O
the	O
effective	O
topology	O
at	O
grompp	O
run	O
time	O
.	O
</s>
