8

I know the term "scripting languages" is just a subset of programming languages, but I want to refer to programming languages such as Python and Ruby among others.

  1. First of all, why don't we need a compiler for these languages? For example, IDEs like Visual Studio or Eclipse have their own compiler in order to translate the code and execute the program. What does it mean for a programming language to be interpreted and how are they (Python, Ruby) compiled before execution in the terminal without a compiler?

  2. Also, when we install Python or Ruby in our computers before we start coding, what are we actually installing? packages? files? something that lets our computer understand the language?

5
  • Some scripting languages (e.g. Lua or Python or Neko) are compiled to a bytecode. See also this Oct 15, 2015 at 20:39
  • ... Others (for example perl) may be compiled into an internal representation (perl is always compiling to an internal (but not bytecode) representation). That representation may be then fed through the interpreter, or to another compiler (that produces C source code). This can be further confused in that the interpreter part may be invoked in the middle of a compilation phase (the BEGIN block). The line between compilers and interpreters is very fuzzy now. IMHO: its best to forget about 'scripting' languages. They are languages. That's it.
    – user40980
    Oct 15, 2015 at 20:48
  • 2
    You don't need a compiler for any language. Not even C.
    – user253751
    Oct 16, 2015 at 5:01
  • There are lots of interesting question with "Python" and "compile" tags. I recommend reading those ( shameless plug : programmers.stackexchange.com/questions/243269/… )
    – Euphoric
    Oct 16, 2015 at 6:33
  • C interpreters exist. Oct 16, 2015 at 9:27

1 Answer 1

16

What does it mean for a programming language to be interpreted and how are they compiled before execution in the terminal?

Compilers and interpreters are very similar things, right up until the last step. For a compiler, the last step is to generate code in the output language and save it. For an interpreter, it's not trying to save your code; it's trying to execute it immediately. It does this by breaking down the program into basic semantic commands, much like the compiler does, and then executing those commands via a runtime that implements them in software.

2) Also, when we install Python or Ruby in our computers before start coding, what are we actually installing? packages? files? something that lets our computer understand the language?

Generally speaking, you're installing the interpreter and the standard libraries. Most likely some basic tools (such as a REPL, in the case of many scripting languages) get installed too as part of the standard package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.