<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
declarative	B-Language
programming	I-Language
is	O
a	O
programming	O
paradigm	O
—	O
a	O
style	O
of	O
building	O
the	O
structure	O
and	O
elements	O
of	O
computer	O
programs	B-General_Concept
—	O
that	O
expresses	O
the	O
logic	O
of	O
a	O
computation	O
without	O
describing	O
its	O
control	O
flow	O
.	O
</s>
<s>
Many	O
languages	O
that	O
apply	O
this	O
style	O
attempt	O
to	O
minimize	O
or	O
eliminate	O
side	O
effects	O
by	O
describing	O
what	O
the	O
program	O
must	O
accomplish	O
in	O
terms	O
of	O
the	O
problem	O
domain	O
,	O
rather	O
than	O
describing	O
how	O
to	O
accomplish	O
it	O
as	O
a	O
sequence	O
of	O
the	O
programming	O
language	O
primitives	O
(	O
the	O
how	O
being	O
left	O
up	O
to	O
the	O
language	O
's	O
implementation	B-Application
)	O
.	O
</s>
<s>
This	O
is	O
in	O
contrast	O
with	O
imperative	B-Application
programming	I-Application
,	O
which	O
implements	O
algorithms	O
in	O
explicit	O
steps	O
.	O
</s>
<s>
Declarative	B-Language
programming	I-Language
often	O
considers	O
programs	B-General_Concept
as	O
theories	O
of	O
a	O
formal	O
logic	O
,	O
and	O
computations	O
as	O
deductions	O
in	O
that	O
logic	O
space	O
.	O
</s>
<s>
Declarative	B-Language
programming	I-Language
may	O
greatly	O
simplify	O
writing	O
parallel	B-Operating_System
programs	I-Operating_System
.	O
</s>
<s>
Common	O
declarative	B-Language
languages	I-Language
include	O
those	O
of	O
database	B-Language
query	I-Language
languages	I-Language
(	O
e.g.	O
,	O
SQL	B-Language
,	O
XQuery	B-Language
)	O
,	O
regular	B-Language
expressions	I-Language
,	O
logic	B-Language
programming	I-Language
,	O
functional	B-Language
programming	I-Language
,	O
and	O
configuration	B-Application
management	I-Application
systems	O
.	O
</s>
<s>
Declarative	B-Language
programming	I-Language
is	O
often	O
defined	O
as	O
any	O
style	O
of	O
programming	O
that	O
is	O
not	O
imperative	B-Application
.	O
</s>
<s>
A	O
number	O
of	O
other	O
common	O
definitions	O
attempt	O
to	O
define	O
it	O
by	O
simply	O
contrasting	O
it	O
with	O
imperative	B-Application
programming	I-Application
.	O
</s>
<s>
Declarative	B-Language
programming	I-Language
is	O
a	O
non-imperative	O
style	O
of	O
programming	O
in	O
which	O
programs	B-General_Concept
describe	O
their	O
desired	O
results	O
without	O
explicitly	O
listing	O
commands	O
or	O
steps	O
that	O
must	O
be	O
performed	O
.	O
</s>
<s>
Functional	B-Language
and	O
logical	B-Language
programming	I-Language
languages	I-Language
are	O
characterized	O
by	O
a	O
declarative	B-Language
programming	I-Language
style	O
.	O
</s>
<s>
In	O
logical	B-Language
programming	I-Language
languages	I-Language
,	O
programs	B-General_Concept
consist	O
of	O
logical	O
statements	O
,	O
and	O
the	O
program	O
executes	O
by	O
searching	O
for	O
proofs	O
of	O
the	O
statements	O
.	O
</s>
<s>
In	O
a	O
pure	B-Application
functional	I-Application
language	O
,	O
such	O
as	O
Haskell	B-Language
,	O
all	O
functions	O
are	O
without	B-Application
side	I-Application
effects	I-Application
,	O
and	O
state	O
changes	O
are	O
only	O
represented	O
as	O
functions	O
that	O
transform	O
the	O
state	O
,	O
which	O
is	O
explicitly	O
represented	O
as	O
a	O
first-class	O
object	O
in	O
the	O
program	O
.	O
</s>
<s>
Although	O
pure	B-Application
functional	I-Application
languages	O
are	O
non-imperative	O
,	O
they	O
often	O
provide	O
a	O
facility	O
for	O
describing	O
the	O
effect	O
of	O
a	O
function	O
as	O
a	O
series	O
of	O
steps	O
.	O
</s>
<s>
Other	O
functional	B-Language
languages	I-Language
,	O
such	O
as	O
Lisp	B-Language
,	O
OCaml	B-Language
and	O
Erlang	B-Operating_System
,	O
support	O
a	O
mixture	O
of	O
procedural	B-Application
and	O
functional	B-Language
programming	I-Language
.	O
</s>
<s>
Some	O
logical	B-Language
programming	I-Language
languages	I-Language
,	O
such	O
as	O
Prolog	B-Language
,	O
and	O
database	B-Language
query	I-Language
languages	I-Language
,	O
such	O
as	O
SQL	B-Language
,	O
while	O
declarative	B-Language
in	O
principle	O
,	O
also	O
support	O
a	O
procedural	B-Application
style	O
of	O
programming	O
.	O
</s>
<s>
Declarative	B-Language
programming	I-Language
is	O
an	O
umbrella	O
term	O
that	O
includes	O
a	O
number	O
of	O
better-known	O
programming	O
paradigms	O
.	O
</s>
<s>
Constraint	B-Application
programming	I-Application
states	O
relations	O
between	O
variables	O
in	O
the	O
form	O
of	O
constraints	O
that	O
specify	O
the	O
properties	O
of	O
the	O
target	O
solution	O
.	O
</s>
<s>
The	O
set	O
of	O
constraints	O
is	O
solved	B-Application
by	O
giving	O
a	O
value	O
to	O
each	O
variable	O
so	O
that	O
the	O
solution	O
is	O
consistent	O
with	O
the	O
maximum	O
number	O
of	O
constraints	O
.	O
</s>
<s>
Constraint	B-Application
programming	I-Application
often	O
complements	O
other	O
paradigms	O
:	O
functional	B-Language
,	O
logical	O
,	O
or	O
even	O
imperative	B-Application
programming	I-Application
.	O
</s>
<s>
Well-known	O
examples	O
of	O
declarative	B-Language
domain-specific	B-Language
languages	I-Language
(	O
DSLs	O
)	O
include	O
the	O
yacc	B-Application
parser	O
generator	O
input	O
language	O
,	O
QML	B-Language
,	O
the	O
Make	B-Application
build	O
specification	O
language	O
,	O
Puppet	B-Application
's	O
configuration	B-Application
management	I-Application
language	O
,	O
regular	B-Language
expressions	I-Language
,	O
and	O
a	O
subset	O
of	O
SQL	B-Language
(	O
SELECT	O
queries	O
,	O
for	O
example	O
)	O
.	O
</s>
<s>
DSLs	O
have	O
the	O
advantage	O
of	O
being	O
useful	O
while	O
not	O
necessarily	O
needing	O
to	O
be	O
Turing-complete	O
,	O
which	O
makes	O
it	O
easier	O
for	O
a	O
language	O
to	O
be	O
purely	O
declarative	B-Language
.	O
</s>
<s>
Many	O
markup	O
languages	O
such	O
as	O
HTML	B-Language
,	O
MXML	B-Operating_System
,	O
XAML	B-Device
,	O
XSLT	B-Application
or	O
other	O
user-interface	B-Language
markup	I-Language
languages	I-Language
are	O
often	O
declarative	B-Language
.	O
</s>
<s>
HTML	B-Language
,	O
for	O
example	O
,	O
only	O
describes	O
what	O
should	O
appear	O
on	O
a	O
webpage	O
-	O
it	O
specifies	O
neither	O
control	O
flow	O
for	O
rendering	O
a	O
page	O
nor	O
the	O
page	O
's	O
possible	O
interactions	O
with	O
a	O
user	O
.	O
</s>
<s>
,	O
some	O
software	O
systems	O
combine	O
traditional	O
user-interface	B-Language
markup	I-Language
languages	I-Language
(	O
such	O
as	O
HTML	B-Language
)	O
with	O
declarative	B-Language
markup	O
that	O
defines	O
what	O
(	O
but	O
not	O
how	O
)	O
the	O
back-end	O
server	O
systems	O
should	O
do	O
to	O
support	O
the	O
declared	O
interface	O
.	O
</s>
<s>
Such	O
systems	O
,	O
typically	O
using	O
a	O
domain-specific	O
XML	B-Language
namespace	I-Language
,	O
may	O
include	O
abstractions	O
of	O
SQL	B-Language
database	I-Language
syntax	O
or	O
parameterized	O
calls	O
to	O
web	O
services	O
using	O
representational	B-Protocol
state	I-Protocol
transfer	I-Protocol
(	O
REST	O
)	O
and	O
SOAP	B-Application
.	O
</s>
<s>
Functional	B-Language
programming	I-Language
languages	I-Language
such	O
as	O
Haskell	B-Language
,	O
Scheme	B-Language
,	O
and	O
ML	B-Language
evaluate	O
expressions	O
via	O
function	O
application	O
.	O
</s>
<s>
Unlike	O
the	O
related	O
but	O
more	O
imperative	B-Application
paradigm	I-Application
of	O
Procedural	B-Application
programming	I-Application
,	O
functional	B-Language
programming	I-Language
places	O
little	O
emphasis	O
on	O
explicit	O
sequencing	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Scheme	B-Language
,	O
the	O
order	O
of	O
evaluation	O
of	O
many	O
kinds	O
of	O
sub-expressions	O
is	O
undefined	O
or	O
implicit	O
.	O
</s>
<s>
Instead	O
,	O
computations	O
are	O
characterised	O
by	O
various	O
kinds	O
of	O
recursive	O
higher-order	B-Language
function	I-Language
application	O
and	O
composition	B-Application
,	O
and	O
as	O
such	O
can	O
be	O
regarded	O
simply	O
as	O
a	O
set	O
of	O
mappings	O
between	O
domains	O
and	O
codomains	B-Algorithm
.	O
</s>
<s>
Many	O
functional	B-Language
languages	I-Language
,	O
including	O
most	O
of	O
those	O
in	O
the	O
ML	B-Language
and	O
Lisp	B-Language
families	O
,	O
are	O
not	O
purely	B-Application
functional	I-Application
,	O
and	O
thus	O
allow	O
the	O
introduction	O
of	O
stateful	O
effects	O
in	O
programs	B-General_Concept
,	O
though	O
this	O
is	O
typically	O
avoided	O
when	O
possible	O
.	O
</s>
<s>
Makefiles	O
,	O
for	O
example	O
,	O
specify	O
dependencies	O
in	O
a	O
declarative	B-Language
fashion	O
,	O
but	O
include	O
an	O
imperative	B-Application
list	O
of	O
actions	O
to	O
take	O
as	O
well	O
.	O
</s>
<s>
Similarly	O
,	O
yacc	B-Application
specifies	O
a	O
context	O
free	O
grammar	O
declaratively	O
,	O
but	O
includes	O
code	O
snippets	O
from	O
a	O
host	O
language	O
,	O
which	O
is	O
usually	O
imperative	B-Application
(	O
such	O
as	O
C	B-Language
)	O
.	O
</s>
<s>
Logic	B-Language
programming	I-Language
languages	I-Language
such	O
as	O
Prolog	B-Language
state	O
and	O
query	O
relations	O
.	O
</s>
<s>
The	O
specifics	O
of	O
how	O
these	O
queries	O
are	O
answered	O
is	O
up	O
to	O
the	O
implementation	B-Application
and	O
its	O
theorem	O
prover	O
,	O
but	O
typically	O
take	O
the	O
form	O
of	O
some	O
sort	O
of	O
unification	B-Algorithm
.	O
</s>
<s>
Like	O
functional	B-Language
programming	I-Language
,	O
many	O
logic	B-Language
programming	I-Language
languages	I-Language
permit	O
side	O
effects	O
,	O
and	O
as	O
a	O
result	O
are	O
not	O
strictly	O
declarative	B-Language
.	O
</s>
<s>
Models	O
,	O
or	O
mathematical	O
representations	O
,	O
of	O
physical	O
systems	O
may	O
be	O
implemented	O
in	O
computer	O
code	O
that	O
is	O
declarative	B-Language
.	O
</s>
<s>
The	O
code	O
contains	O
a	O
number	O
of	O
equations	O
,	O
not	O
imperative	B-Application
assignments	O
,	O
that	O
describe	O
(	O
"	O
declare	O
"	O
)	O
the	O
behavioral	O
relationships	O
.	O
</s>
<s>
The	O
mathematical	O
causality	O
is	O
typically	O
imposed	O
at	O
the	O
boundaries	O
of	O
the	O
physical	O
system	O
,	O
while	O
the	O
behavioral	O
description	O
of	O
the	O
system	O
itself	O
is	O
declarative	B-Language
or	O
acausal	O
.	O
</s>
<s>
Declarative	B-Language
modeling	B-Language
languages	I-Language
and	O
environments	B-Application
include	O
Analytica	B-Language
,	O
Modelica	B-Application
and	O
Simile	O
.	O
</s>
<s>
Lisp	B-Language
(	O
1958	O
)	O
stands	O
for	O
"	O
LISt	O
Processor.	O
"	O
</s>
<s>
In	O
memory	O
,	O
this	O
forms	O
a	O
tree	B-Application
data	I-Application
structure	I-Application
.	O
</s>
<s>
Internally	O
,	O
the	O
tree	O
structure	O
of	O
typical	O
Lisp	B-Language
data	O
lends	O
itself	O
nicely	O
to	O
processing	O
with	O
recursive	O
functions	O
.	O
</s>
<s>
Lisp	B-Language
has	O
functions	O
to	O
extract	O
and	O
reconstruct	O
elements	O
.	O
</s>
<s>
As	O
is	O
typical	O
in	O
functional	B-Language
languages	I-Language
,	O
operations	O
in	O
Lisp	B-Language
often	O
copy	O
data	O
when	O
asked	O
to	O
produce	O
new	O
data	O
from	O
old	O
.	O
</s>
<s>
The	O
tree	O
structure	O
of	O
Lisp	B-Language
data	O
facilitates	O
this	O
as	O
well	O
:	O
a	O
new	O
structure	O
made	O
from	O
pre-existing	O
data	O
shares	O
as	O
much	O
of	O
its	O
internal	O
structure	O
with	O
its	O
antecedents	O
as	O
possible	O
,	O
with	O
new	O
additions	O
stored	O
as	O
branches	O
of	O
the	O
tree	O
,	O
and	O
references	O
to	O
the	O
original	O
structure	O
under	O
its	O
original	O
name	O
will	O
return	O
exactly	O
that	O
and	O
no	O
more	O
.	O
</s>
<s>
One	O
drawback	O
of	O
Lisp	B-Language
is	O
when	O
many	O
functions	O
are	O
nested	O
,	O
the	O
parentheses	O
may	O
look	O
confusing	O
.	O
</s>
<s>
Modern	O
Lisp	B-Language
environments	B-Application
help	O
ensure	O
parenthesis	O
match	O
.	O
</s>
<s>
As	O
an	O
aside	O
,	O
Lisp	B-Language
does	O
support	O
the	O
imperative	B-Application
language	I-Application
operations	O
of	O
the	O
assignment	O
statement	O
and	O
goto	O
loops	O
.	O
</s>
<s>
Also	O
,	O
Lisp	B-Language
is	O
not	O
concerned	O
with	O
the	O
datatype	O
of	O
the	O
elements	O
at	O
compile	O
time	O
.	O
</s>
<s>
To	O
counteract	O
this	O
,	O
Lisp	B-Language
development	O
is	O
typically	O
carried	O
out	O
in	O
an	O
extremely	O
incremental	O
manner	O
,	O
with	O
functions	O
and	O
higher-order	B-Language
functions	I-Language
built	O
up	O
and	O
tested	O
live	O
during	O
development	O
.	O
</s>
<s>
Additionally	O
,	O
through	O
the	O
use	O
of	O
macros	O
,	O
which	O
are	O
Lisp	B-Language
functions	O
that	O
operate	O
upon	O
Lisp	B-Language
programs	B-General_Concept
as	O
data	O
structures	O
,	O
type	O
checking	O
may	O
be	O
performed	O
discretionally	O
at	O
any	O
point	O
the	O
programmer	O
wishes	O
.	O
</s>
<s>
Writing	O
large	O
,	O
reliable	O
,	O
and	O
readable	O
Lisp	B-Language
programs	B-General_Concept
requires	O
forethought	O
.	O
</s>
<s>
If	O
properly	O
planned	O
,	O
the	O
program	O
may	O
be	O
much	O
shorter	O
than	O
an	O
equivalent	O
imperative	B-Application
language	I-Application
program	O
.	O
</s>
<s>
Lisp	B-Language
is	O
widely	O
used	O
in	O
artificial	B-Application
intelligence	I-Application
.	I-Application
</s>
<s>
However	O
,	O
its	O
usage	O
has	O
been	O
accepted	O
only	O
because	O
it	O
has	O
imperative	B-Application
language	I-Application
operations	O
,	O
making	O
unintended	O
side-effects	O
possible	O
.	O
</s>
<s>
ML	B-Language
(	O
1973	O
)	O
stands	O
for	O
"	O
Meta	O
Language.	O
"	O
</s>
<s>
ML	B-Language
is	O
statically	O
typed	O
,	O
and	O
function	O
arguments	O
and	O
return	O
types	O
may	O
be	O
annotated	O
.	O
</s>
<s>
ML	B-Language
is	O
not	O
parenthesis-eccentric	O
like	O
Lisp	B-Language
.	O
</s>
<s>
Like	O
Lisp	B-Language
,	O
ML	B-Language
is	O
tailored	O
to	O
process	O
lists	O
,	O
though	O
all	O
elements	O
of	O
a	O
list	O
must	O
be	O
the	O
same	O
type	O
.	O
</s>
<s>
Prolog	B-Language
(	O
1972	O
)	O
stands	O
for	O
"	O
PROgramming	O
in	O
LOGic.	O
"	O
</s>
<s>
The	O
building	O
blocks	O
of	O
a	O
Prolog	B-Language
program	O
are	O
objects	O
and	O
their	O
relationships	O
to	O
other	O
objects	O
.	O
</s>
<s>
Prolog	B-Language
's	O
usage	O
has	O
expanded	O
to	O
become	O
a	O
goal-oriented	O
language	O
.	O
</s>
<s>
If	O
a	O
path	O
of	O
subgoals	O
fails	O
to	O
find	O
a	O
solution	O
,	O
then	O
that	O
subgoal	O
is	O
backtracked	B-Algorithm
and	O
another	O
path	O
is	O
systematically	O
attempted	O
.	O
</s>
