什么是 javascript 中的“REPL”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13603021/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is a "REPL" in javascript?
提问by Mark Harrison
I saw a reference to creating a "REPL". What is a REPL?
我看到了创建“REPL”的参考。什么是 REPL?
var arDrone = require('ar-drone');
var client = arDrone.createClient();
client.createRepl();
回答by tomlogic
Good information in the repltag right here on Stack Overflow:
Stack Overflow 上repl标签中的好信息:
About read-eval-print-loop
A Read-Eval-Print Loop (REPL) is an interactive interpreter to a programming language. It originated with LISP systems, but many other languages (Python, Ruby, Haskell, Tcl, etc.) use REPL's to manage interactive sessions. They allow for simple experimentation with a language by bypassing the compile stage of the "code -> compile -> execute" cycle.
There are 4 components to a REPL (named in LISP notation):
- A read function, which reads input from the keyboard
- An eval function, which evaluates code passed to it
- A print function, which formats and displays results
- A loop function, which runs the three previous commands until termination
关于 read-eval-print-loop
Read-Eval-Print Loop (REPL) 是一种编程语言的交互式解释器。它起源于 LISP 系统,但许多其他语言(Python、Ruby、Haskell、Tcl 等)使用 REPL 来管理交互式会话。它们允许通过绕过“代码 -> 编译 -> 执行”循环的编译阶段对语言进行简单的实验。
REPL 有 4 个组件(以 LISP 符号命名):
- 读取函数,从键盘读取输入
- 一个 eval 函数,它评估传递给它的代码
- 打印功能,用于格式化和显示结果
- 一个循环函数,它运行前三个命令直到终止
回答by Konrad Rudolph
The first Google hit gives you the definition on Wikipedia: REPL stands for read–eval–print loop:
第一个 Google 搜索为您提供了 Wikipedia 上的定义:REPL 代表read-eval-print loop:
A read–eval–print loop (REPL) is a simple, interactive computer programming environment.
读取-评估-打印循环 (REPL) 是一种简单的交互式计算机编程环境。
In short, it starts an interactive console where you can type in commands and immediately see the result of these commands.
简而言之,它会启动一个交互式控制台,您可以在其中键入命令并立即查看这些命令的结果。
回答by raymarch
If supported by language, REPL is a interactive way of code or command execution.
如果语言支持,REPL 是代码或命令执行的交互方式。
ftp://ftp.cs.utexas.edu/pub/garbage/cs345/schintro-v14/schintro_114.html
ftp://ftp.cs.utexas.edu/pub/garbage/cs345/schintro-v14/schintro_114.html