Relation between REPL, interpreter and compiler

后端 未结 3 1781
挽巷
挽巷 2021-01-06 08:06

From Wikipedia:

The REPL is commonly misnamed an interpreter. This is a misnomer—many programming languages that use compilation (including byte

3条回答
  •  天涯浪人
    2021-01-06 08:32

    REPL stands for Read-Eval-Print-Loop. Both an interpreter and a compiler can be used to do the eval bit - either have an instance of the interpreter running in the background and feed it the input, or use the compiler to compile incrementally (granted, this takes much more work and some cooperation from the compiler writers, but it's possible, as countless instances show - you generally only compile to bytecode though). The rest is mostly I/O and some glue to keep all the previously entered definitions available for the next commands.

提交回复
热议问题