4 ms·
You don't need an interpreter for a REPL. Swift's REPL performs line-at-a-time compilation, running the program to that line and suspending it until you write a
by gilgoomesh 8y ago
You don't need an interpreter for a REPL. Swift's REPL performs line-at-a-time compilation, running the program to that line and suspending it until you write and compile another line.
- coldtea 8y ago>You don't need an interpreter for a REPL. Swift's REPL performs line-at-a-time compilation Isn't that another way to say "interpreter"?
- notacoward 8y agoFor all practical purposes, yes. In the strictest technical sense it's a form of JIT compilation, but that can be considered an optimization or implementation technique. If the user doesn't perceive a separate compilation step, it's effectively an interpreter and only a dedicated pedant would "well actually" that it's compilation.
- creatornator 8y agoNot really. An interpreter doesn't convert the language syntax tree into machine code, instead it just performs the operations. It sounds like Swift's REPL actually converts the lines into opcodes and runs those.