What is the difference between an interpreted computer language and a compiled one?

An interpreted language is translated into binary all at once; a compiled language is translated line by line
a compiled language is translated into a binary all at once; an interpreted language is translated line by line
an interpreted language is translated into binary; a compiled language is combined from more than one language
a compiled language is translated into binary; an interpreted language is combined from more than one language

1 answer

The correct distinction between an interpreted language and a compiled language is:

A compiled language is translated into binary all at once; an interpreted language is translated line by line.

To elaborate:

  • Compiled Languages: In these languages, the entire source code is translated into machine code (binary) by a compiler before it is executed. This results in a standalone executable file that can be run independently. Examples include C, C++, and Rust.

  • Interpreted Languages: In these languages, the source code is translated line by line or statement by statement at runtime by an interpreter. This means that the code is executed directly, without the need for a separate compilation step. Examples include Python, JavaScript, and Ruby.

Note that in practice, some languages can be both compiled and interpreted (for example, Java is initially compiled to bytecode and then interpreted by the Java Virtual Machine).