<s>
In	O
computing	O
,	O
a	O
meta-circular	B-Application
evaluator	I-Application
(	O
MCE	O
)	O
or	O
meta-circular	B-Application
interpreter	I-Application
(	O
MCI	O
)	O
is	O
an	O
interpreter	B-Application
which	O
defines	O
each	O
feature	O
of	O
the	O
interpreted	B-Application
language	I-Application
using	O
a	O
similar	O
facility	O
of	O
the	O
interpreter	B-Application
's	O
host	O
language	O
.	O
</s>
<s>
Meta-circular	B-Application
evaluation	I-Application
is	O
most	O
prominent	O
in	O
the	O
context	O
of	O
Lisp	B-Language
.	O
</s>
<s>
A	O
self-interpreter	O
is	O
a	O
meta-circular	B-Application
interpreter	I-Application
where	O
the	O
interpreted	B-Application
language	I-Application
is	O
nearly	O
identical	O
to	O
the	O
host	O
language	O
;	O
the	O
two	O
terms	O
are	O
often	O
used	O
synonymously	O
.	O
</s>
<s>
Due	O
to	O
the	O
difficulty	O
of	O
compiling	O
higher-order	B-Language
functions	I-Language
,	O
many	O
languages	O
were	O
instead	O
defined	O
via	O
interpreters	B-Application
,	O
most	O
prominently	O
Lisp	B-Language
.	O
</s>
<s>
The	O
term	O
itself	O
was	O
coined	O
by	O
John	O
C	O
.	O
Reynolds	O
,	O
and	O
popularized	O
through	O
its	O
use	O
in	O
the	O
book	O
Structure	B-Language
and	I-Language
Interpretation	I-Language
of	I-Language
Computer	I-Language
Programs	I-Language
.	O
</s>
<s>
A	O
self-interpreter	O
is	O
a	O
meta-circular	B-Application
interpreter	I-Application
where	O
the	O
host	O
language	O
is	O
also	O
the	O
language	O
being	O
interpreted	O
.	O
</s>
<s>
A	O
self-interpreter	O
displays	O
a	O
universal	O
function	O
for	O
the	O
language	O
in	O
question	O
,	O
and	O
can	O
be	O
helpful	O
in	O
learning	O
certain	O
aspects	O
of	O
the	O
language	O
.	O
</s>
<s>
A	O
self-interpreter	O
will	O
provide	O
a	O
circular	O
,	O
vacuous	O
definition	O
of	O
most	O
language	O
constructs	O
and	O
thus	O
provides	O
little	O
insight	O
into	O
the	O
interpreted	B-Application
language	I-Application
's	O
semantics	O
,	O
for	O
example	O
evaluation	B-Language
strategy	I-Language
.	O
</s>
<s>
Addressing	O
these	O
issues	O
produces	O
the	O
more	O
general	O
notion	O
of	O
a	O
"	O
definitional	O
interpreter	B-Application
"	O
.	O
</s>
<s>
The	O
evaluator	B-Application
uses	O
an	O
environment	O
:	O
</s>
<s>
The	O
core	O
evaluator	B-Application
has	O
three	O
clauses	O
:	O
</s>
<s>
It	O
maps	O
a	O
variable	O
(	O
represented	O
with	O
a	O
de	B-Application
Bruijn	I-Application
index	I-Application
)	O
into	O
the	O
value	O
in	O
the	O
current	O
environment	O
at	O
this	O
index	O
.	O
</s>
<s>
In	O
"	O
Definitional	O
Interpreters	B-Application
"	O
,	O
Reynolds	O
answered	O
the	O
question	O
as	O
to	O
whether	O
such	O
a	O
self-interpreter	O
is	O
well	O
defined	O
.	O
</s>
<s>
He	O
answered	O
in	O
the	O
negative	O
because	O
the	O
evaluation	B-Language
strategy	I-Language
of	O
the	O
defined	O
language	O
(	O
the	O
source	O
language	O
)	O
is	O
determined	O
by	O
the	O
evaluation	B-Language
strategy	I-Language
of	O
the	O
defining	O
language	O
(	O
the	O
meta-language	O
)	O
.	O
</s>
<s>
If	O
the	O
meta-language	O
follows	O
call	O
by	O
value	O
(	O
as	O
OCaml	B-Language
does	O
)	O
,	O
the	O
source	O
language	O
follows	O
call	O
by	O
value	O
.	O
</s>
<s>
If	O
the	O
meta-language	O
follows	O
call	O
by	O
name	O
(	O
as	O
Algol	B-Language
60	I-Language
does	O
)	O
,	O
the	O
source	O
language	O
follows	O
call	O
by	O
name	O
.	O
</s>
<s>
And	O
if	O
the	O
meta-language	O
follows	O
call	O
by	O
need	O
(	O
as	O
Haskell	B-Language
does	O
)	O
,	O
the	O
source	O
language	O
follows	O
call	O
by	O
need	O
.	O
</s>
<s>
In	O
"	O
Definitional	O
Interpreters	B-Application
"	O
,	O
Reynolds	O
made	O
a	O
self-interpreter	O
well	O
defined	O
by	O
making	O
it	O
independent	O
of	O
the	O
evaluation	B-Language
strategy	I-Language
of	O
its	O
defining	O
language	O
.	O
</s>
<s>
He	O
fixed	O
the	O
evaluation	B-Language
strategy	I-Language
by	O
transforming	O
the	O
self-interpreter	O
into	O
Continuation-Passing	B-Application
Style	I-Application
,	O
which	O
is	O
evaluation-strategy	O
independent	O
,	O
as	O
later	O
captured	O
in	O
Gordon	O
Plotkin	O
's	O
Independence	O
Theorems	O
.	O
</s>
<s>
Furthermore	O
,	O
because	O
logical	O
relations	O
had	O
yet	O
to	O
be	O
discovered	O
,	O
Reynolds	O
made	O
the	O
resulting	O
continuation-passing	B-Application
evaluator	B-Application
first	O
order	O
by	O
(	O
1	O
)	O
closure-converting	B-Language
it	O
and	O
(	O
2	O
)	O
defunctionalizing	B-Application
the	O
continuation	O
.	O
</s>
<s>
He	O
pointed	O
out	O
the	O
"	O
machine-like	O
quality	O
"	O
of	O
the	O
resulting	O
interpreter	B-Application
,	O
which	O
is	O
the	O
origin	O
of	O
the	O
CEK	O
machine	O
since	O
Reynolds	O
's	O
CPS	O
transformation	O
was	O
for	O
call	O
by	O
value	O
.	O
</s>
<s>
For	O
call	O
by	O
name	O
,	O
these	O
transformations	O
map	O
the	O
self-interpreter	O
to	O
an	O
early	O
instance	O
of	O
the	O
Krivine	B-Application
machine	I-Application
.	O
</s>
<s>
The	O
SECD	B-Application
machine	I-Application
and	O
many	O
other	O
abstract	O
machines	O
can	O
be	O
inter-derived	O
this	O
way	O
.	O
</s>
<s>
It	O
is	O
remarkable	O
that	O
the	O
three	O
most	O
famous	O
abstract	O
machines	O
for	O
the	O
calculus	O
functionally	O
correspond	O
to	O
the	O
same	O
self-interpreter	O
.	O
</s>
<s>
Total	B-Application
functional	I-Application
programming	I-Application
languages	O
that	O
are	O
strongly	O
normalizing	O
cannot	O
be	O
Turing	B-Algorithm
complete	I-Algorithm
,	O
otherwise	O
one	O
could	O
solve	O
the	O
halting	O
problem	O
by	O
seeing	O
if	O
the	O
program	O
type-checks	O
.	O
</s>
<s>
That	O
means	O
that	O
there	O
are	O
computable	O
functions	O
that	O
cannot	O
be	O
defined	O
in	O
the	O
total	B-Application
language	I-Application
.	O
</s>
<s>
In	O
particular	O
it	O
is	O
impossible	O
to	O
define	O
a	O
self-interpreter	O
in	O
a	O
total	O
programming	O
language	O
,	O
for	O
example	O
in	O
any	O
of	O
the	O
typed	O
lambda	O
calculi	O
such	O
as	O
the	O
simply	O
typed	O
lambda	O
calculus	O
,	O
Jean-Yves	O
Girard	O
's	O
System	O
F	O
,	O
or	O
Thierry	O
Coquand	O
's	O
calculus	B-Application
of	I-Application
constructions	I-Application
.	O
</s>
<s>
Here	O
,	O
by	O
"	O
self-interpreter	O
"	O
we	O
mean	O
a	O
program	O
that	O
takes	O
a	O
source	O
term	O
representation	O
in	O
some	O
plain	O
format	O
(	O
such	O
as	O
a	O
string	O
of	O
characters	O
)	O
and	O
returns	O
a	O
representation	O
of	O
the	O
corresponding	O
normalized	O
term	O
.	O
</s>
<s>
This	O
impossibility	O
result	O
does	O
not	O
hold	O
for	O
other	O
definitions	O
of	O
"	O
self-interpreter	O
"	O
.	O
</s>
<s>
For	O
example	O
,	O
some	O
authors	O
have	O
referred	O
to	O
functions	O
of	O
type	O
as	O
self-interpreters	O
,	O
where	O
is	O
the	O
type	O
of	O
representations	O
of	O
-typed	O
terms	O
.	O
</s>
<s>
In	O
their	O
follow-up	O
work	O
,	O
they	O
switch	O
to	O
the	O
more	O
specific	O
"	O
self-recognizer	O
"	O
terminology	O
used	O
here	O
,	O
notably	O
distinguishing	O
these	O
from	O
"	O
self-evaluators	O
"	O
,	O
of	O
type	O
.	O
</s>
<s>
In	O
combination	O
with	O
an	O
existing	O
language	O
implementation	O
,	O
meta-circular	B-Application
interpreters	I-Application
provide	O
a	O
baseline	O
system	O
from	O
which	O
to	O
extend	O
a	O
language	O
,	O
either	O
upwards	O
by	O
adding	O
more	O
features	O
or	O
downwards	O
by	O
compiling	O
away	O
features	O
rather	O
than	O
interpreting	O
them	O
.	O
</s>
<s>
A	O
language	O
designed	O
with	O
a	O
meta-circular	B-Application
implementation	O
in	O
mind	O
is	O
often	O
more	O
suited	O
for	O
building	O
languages	O
in	O
general	O
,	O
even	O
ones	O
completely	O
different	O
from	O
the	O
host	O
language	O
.	O
</s>
<s>
Many	O
languages	O
have	O
one	O
or	O
more	O
meta-circular	B-Application
implementations	O
.	O
</s>
<s>
Some	O
languages	O
with	O
a	O
meta-circular	B-Application
implementation	O
designed	O
from	O
the	O
bottom	O
up	O
,	O
in	O
grouped	O
chronological	O
order	O
:	O
</s>
<s>
Some	O
languages	O
with	O
a	O
meta-circular	B-Application
implementation	O
via	O
third	O
parties	O
:	O
</s>
