Scripting Languages – How Are They Compiled?

compilerprogramming-languagespythonrubyscripting

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?

Best Answer

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.

Related Topic