<s>
A	O
read	B-Application
–	I-Application
eval	I-Application
–	I-Application
print	I-Application
loop	I-Application
(	O
REPL	B-Application
)	O
,	O
also	O
termed	O
an	O
interactive	O
toplevel	O
or	O
language	O
shell	B-Operating_System
,	O
is	O
a	O
simple	O
interactive	O
computer	B-General_Concept
programming	I-General_Concept
environment	O
that	O
takes	O
single	O
user	O
inputs	O
,	O
executes	O
them	O
,	O
and	O
returns	O
the	O
result	O
to	O
the	O
user	O
;	O
a	O
program	O
written	O
in	O
a	O
REPL	B-Application
environment	O
is	O
executed	O
piecewise	O
.	O
</s>
<s>
The	O
term	O
usually	O
refers	O
to	O
programming	O
interfaces	O
similar	O
to	O
the	O
classic	O
Lisp	B-Operating_System
machine	I-Operating_System
interactive	O
environment	O
.	O
</s>
<s>
Common	O
examples	O
include	O
command-line	B-Application
shells	B-Operating_System
and	O
similar	O
environments	O
for	O
programming	O
languages	O
,	O
and	O
the	O
technique	O
is	O
very	O
characteristic	O
of	O
scripting	B-Language
languages	I-Language
.	O
</s>
<s>
The	O
first	O
Read-Eval-Print	B-Application
loop	I-Application
,	O
cycle	O
,	O
was	O
invented	O
in	O
1964	O
by	O
L	O
.	O
Peter	O
Deutsch	O
and	O
Edmund	O
Berkeley	O
for	O
an	O
implementation	O
of	O
Lisp	B-Language
on	O
the	O
PDP-1	B-Device
.	O
</s>
<s>
In	O
a	O
REPL	B-Application
,	O
the	O
user	O
enters	O
one	O
or	O
more	O
expressions	O
(	O
rather	O
than	O
an	O
entire	O
compilation	B-Language
unit	I-Language
)	O
and	O
the	O
REPL	B-Application
evaluates	O
them	O
and	O
displays	O
the	O
results	O
.	O
</s>
<s>
The	O
name	O
read	B-Application
–	I-Application
eval	I-Application
–	I-Application
print	I-Application
loop	I-Application
comes	O
from	O
the	O
names	O
of	O
the	O
Lisp	B-Language
primitive	O
functions	O
which	O
implement	O
this	O
functionality	O
:	O
</s>
<s>
The	O
read	O
function	O
accepts	O
an	O
expression	O
from	O
the	O
user	O
,	O
and	O
parses	B-Language
it	O
into	O
a	O
data	O
structure	O
in	O
memory	O
.	O
</s>
<s>
For	O
instance	O
,	O
the	O
user	O
may	O
enter	O
the	O
s-expression	B-Protocol
( +	O
1	O
2	O
3	O
)	O
,	O
which	O
is	O
parsed	B-Language
into	O
a	O
linked	B-Data_Structure
list	I-Data_Structure
containing	O
four	O
data	O
elements	O
.	O
</s>
<s>
In	O
Lisp	B-Language
,	O
evaluating	O
an	O
s-expression	B-Protocol
beginning	O
with	O
the	O
name	O
of	O
a	O
function	O
means	O
calling	O
that	O
function	O
on	O
the	O
arguments	O
that	O
make	O
up	O
the	O
rest	O
of	O
the	O
expression	O
.	O
</s>
<s>
If	O
it	O
is	O
a	O
complex	O
expression	O
,	O
it	O
may	O
be	O
pretty-printed	B-Application
to	O
make	O
it	O
easier	O
to	O
understand	O
.	O
</s>
<s>
REPLs	B-Application
facilitate	O
exploratory	B-Application
programming	I-Application
and	O
debugging	O
because	O
the	O
programmer	O
can	O
inspect	O
the	O
printed	O
result	O
before	O
deciding	O
what	O
expression	O
to	O
provide	O
for	O
the	O
next	O
read	O
.	O
</s>
<s>
The	O
read	B-Application
–	I-Application
eval	I-Application
–	I-Application
print	I-Application
loop	I-Application
involves	O
the	O
programmer	O
more	O
frequently	O
than	O
the	O
classic	O
edit	O
–	O
compile	O
–	O
run	O
–	O
debug	O
cycle	O
.	O
</s>
<s>
Because	O
the	O
print	O
function	O
outputs	O
in	O
the	O
same	O
textual	O
format	O
that	O
the	O
read	O
function	O
uses	O
for	O
input	O
,	O
most	O
results	O
are	O
printed	O
in	O
a	O
form	O
that	O
could	O
be	O
copied	O
and	O
pasted	O
back	O
into	O
the	O
REPL	B-Application
.	O
</s>
<s>
In	O
Python	O
,	O
it	O
is	O
the	O
<__module__.class instance> notation, and in Common Lisp, the #<whatever>	O
form	O
.	O
</s>
<s>
The	O
REPL	B-Application
of	O
CLIM	B-Language
,	O
SLIME	B-Operating_System
,	O
and	O
the	O
Symbolics	O
Lisp	B-Operating_System
Machine	I-Operating_System
can	O
also	O
read	O
back	O
unreadable	O
objects	O
.	O
</s>
<s>
REPLs	B-Application
can	O
be	O
created	O
to	O
support	O
any	O
text-based	O
language	O
.	O
</s>
<s>
REPL	B-Application
support	O
for	O
compiled	O
languages	O
is	O
usually	O
achieved	O
by	O
implementing	O
an	O
interpreter	B-Application
on	O
top	O
of	O
a	O
virtual	O
machine	O
which	O
provides	O
an	O
interface	O
to	O
the	O
compiler	O
.	O
</s>
<s>
For	O
example	O
,	O
starting	O
with	O
JDK	O
9	O
,	O
Java	B-Language
included	O
JShell	B-Language
as	O
a	O
command-line	B-Application
interface	I-Application
to	O
the	O
language	O
.	O
</s>
<s>
Various	O
other	O
languages	O
have	O
third-party	O
tools	O
available	O
for	O
download	O
that	O
provide	O
similar	O
shell	B-Operating_System
interaction	O
with	O
the	O
language	O
.	O
</s>
<s>
As	O
a	O
shell	B-Operating_System
,	O
a	O
REPL	B-Application
environment	O
allows	O
users	O
to	O
access	O
relevant	O
features	O
of	O
an	O
operating	O
system	O
in	O
addition	O
to	O
providing	O
access	O
to	O
programming	O
capabilities	O
.	O
</s>
<s>
The	O
most	O
common	O
use	O
for	O
REPLs	B-Application
outside	O
of	O
operating	B-Operating_System
system	I-Operating_System
shells	I-Operating_System
is	O
for	O
interactive	O
prototyping	O
.	O
</s>
<s>
IPython	B-Application
)	O
,	O
interactive	O
software	O
maintenance	O
,	O
benchmarking	O
,	O
and	O
algorithm	O
exploration	O
.	O
</s>
<s>
Typical	O
functionality	O
provided	O
by	O
a	O
Lisp	B-Language
REPL	B-Application
includes	O
:	O
</s>
<s>
These	O
variables	O
are	O
also	O
available	O
in	O
the	O
REPL	B-Application
.	O
</s>
<s>
For	O
example	O
in	O
Common	O
Lisp	B-Language
*	O
refers	O
to	O
the	O
last	O
result	O
,	O
**	O
and	O
***	O
to	O
the	O
results	O
before	O
that	O
.	O
</s>
<s>
Levels	O
of	O
REPLs	B-Application
.	O
</s>
<s>
In	O
many	O
Lisp	B-Language
systems	O
if	O
an	O
error	O
occurs	O
during	O
the	O
reading	O
,	O
evaluation	O
or	O
printing	O
of	O
an	O
expression	O
,	O
the	O
system	O
is	O
not	O
thrown	O
back	O
to	O
the	O
top	O
level	O
with	O
an	O
error	O
message	O
.	O
</s>
<s>
Instead	O
a	O
new	O
REPL	B-Application
,	O
one	O
level	O
deeper	O
,	O
is	O
started	O
in	O
the	O
error	O
context	O
.	O
</s>
<s>
If	O
an	O
error	O
occurs	O
in	O
such	O
a	O
debug	O
REPL	B-Application
,	O
another	O
REPL	B-Application
,	O
again	O
a	O
level	O
deeper	O
,	O
is	O
started	O
.	O
</s>
<s>
Often	O
the	O
REPL	B-Application
offers	O
special	O
debug	O
commands	O
.	O
</s>
<s>
Error	B-General_Concept
handling	I-General_Concept
.	O
</s>
<s>
The	O
REPL	B-Application
provides	O
restarts	O
.	O
</s>
<s>
These	O
restarts	O
can	O
be	O
used	O
,	O
when	O
an	O
error	O
occurs	O
,	O
to	O
go	O
back	O
to	O
a	O
certain	O
REPL	B-Application
level	O
.	O
</s>
<s>
Mouse	B-Device
sensitive	O
input	O
and	O
output	O
of	O
data	O
objects	O
.	O
</s>
<s>
Some	O
REPLs	B-Application
have	O
commands	O
that	O
follow	O
not	O
the	O
s-expression	B-Protocol
syntax	O
,	O
but	O
often	O
work	O
with	O
Lisp	B-Language
data	O
as	O
arguments	O
.	O
</s>
<s>
Graphical	O
REPLs	B-Application
.	O
</s>
<s>
Some	O
Lisp	B-Language
REPLs	B-Application
(	O
the	O
CLIM	B-Language
Listener	O
is	O
an	O
example	O
)	O
accept	O
also	O
graphical	O
input	O
and	O
output	O
.	O
</s>
