e01.org

Read–eval–print loop

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise. The term usually refers to programming interfaces similar to the classic Lisp machine interactive environment or to Common Lisp with the SLIME development environment. Common examples include command-line shells and similar environments for programming languages, and the technique is very characteristic of scripting languages, even though their characteristics can vary greatly. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise. The term usually refers to programming interfaces similar to the classic Lisp machine interactive environment or to Common Lisp with the SLIME development environment. Common examples include command-line shells and similar environments for programming languages, and the technique is very characteristic of scripting languages, even though their characteristics can vary greatly. A minimal definition in Common Lisp is: (loop (print (eval (read)))) where read waits for user input and eval evaluates it. print prints the result, and loop loops indefinitely. You can enter (+ 1 1) and stop the loop with C-c . ===Combining source files and REPL development=== Developers of Lisp applications typically do not write or copy-paste code to a REPL. They use the REPL for quick tests, for debugging and to explore a running system. They write their application in a source file under version control, they use commands or keyboard shortcuts to compile their code interactively. The Lisp process is running and connected to their editor, and it compiles new code "on the fly", without restarting. In Common Lisp, developers typically compile the current function they are working on. They can also compile a whole file, or compile a whole project. When a function is compiled, they may get type warnings (specially with the SBCL implementation), and they can invoke the newly created function from the REPL. If an error occurs, they are given an interactive debugger. This process of compiling one single function and testing it on the REPL is very fast in comparison to other processes. The cycle of writing a new function, compiling it and testing is very short, and interactive, making it suitable for development. It also means that the application state is not lost during development. It is only when they choose to do so that they run or compile all the application from scratch.

References

  1. ^ Hey, Tony; Pápay, Gyuri (2014). The Computing Universe: A Journey through a Revolution . Cambridge University Press. p. 76 . ISBN 978-1-316-12322-5 , "A major characteristic of modern scripting languages is their interactivity, sometimes referred to as a REPL programming environment. ... The characteristics of ease of use and immediate execution with a REPL environment are sometimes taken as the definition of a scripting language" {{ cite book }} : CS1 maint: postscript ( link ) Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  2. ^ L. Peter Deutsch; Edmund Berkeley, The LISP Implementation for the PDP-1 Computer (PDF) , p. 15 Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  3. ^ Joseph Weizenbaum, OPL-I: AN OPEN santichaymi2@gmail.comENDED PROGRAMMING SYSTEM WITHIN CTSS Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  4. ^ Both of these projects were likely carried out in 1963, well before the respective publications appeared. However, it is impossible to place the dates of invention exactly. Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  5. ^ There is a complex and interesting relationship between Lisp and SLIP, both being eponymous "list processing languages" invented by MIT-related academics: Shrager, Jeff (2024), ELIZA Reinterpreted: The world's first chatbot was not intended as a chatbot at all , arXiv : 2406.17650 Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  6. ^ David A. Moon (April 8, 1974), MACLISP Reference Manual (PDF) , p. 89 Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  7. ^ Smith, Jerry D. (1988). An introduction to Scheme . Englewood Cliffs, N.J. : Prentice Hall. p. 8 . ISBN 978-0-13-496712-7 . Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  8. ^ Hanson, Chris (1986). "rep.scm -- Initial 1986 revision of MIT-Scheme" . GitHub . Retrieved 11 June 2023 . Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  9. ^ van Binsbergen, L. Thomas; Verano Merino, Mauricio; Jeanjean, Pierre; van der Storm, Tijs; Combemale, Benoit; Barais, Olivier (2020-11-17). "A principled approach to REPL interpreters". Proceedings of the 2020 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (PDF) . New York, NY, USA: ACM. pp. 84– 100. doi : 10.1145/3426428.3426917 . ISBN 978-1-4503-8178-9 . Wikipedia revision 1356441599, retrieved 2026-11-18 · 1794956400.0
  10. ^ a b Grillmeyer, O. (2013). Exploring Computer Science with Scheme . Undergraduate Texts in Computer Science. Springer New York. p. 239. ISBN 978-1-4757-2937-5 . Retrieved 2021-06-26 . The central component to the Scheme interpreter is the read-eval-print loop . Commands are read in, then evaluated. Finally, the evaluated result is printed. Wikipedia revision 1356441599, retrieved 2026-11-18 · 1624662000.0
source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Read–eval–print loop". 1779904263. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1356441599

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·