Comments

You must log in or register to comment.

sterlingphoenix t1_j27dozs wrote

A compiled language gets converted to machine language (that's what compiling means). This makes it more efficient in many ways, but TL;DR: it'll run faster. Also nobody can look at your code.

Interpreted language is never compiled, as such. You run the interpreter, which reads the file, and translates it to machine language on the fly. This is a lot slower, but means development can be a lot faster and simpler.

12

luxmesa t1_j27du7z wrote

There are programming languages and machine code. Your computer can only understand machine code, so in order to run a program, you need to translate the code you wrote in a programming language into machine code.

There are two ways two do this. Compiling your code means that all the code you wrote is analyzed and translated into machine code ahead of time, so everything is ready when it’s time to run your program. Interpreting means that your code is being translated line by line as it’s being run.

4

RevaniteAnime t1_j27dvuv wrote

With a compiled language, the human friendly code that gets written is compiled in advance before the code can be run, which may take some significant amount of time depending on complexity, into generally faster and more efficient "machine code" which is what computers actually understand.

Interpreted languages don't get compiled, their code gets translated on the fly between the human friendly code and and what the machine can understand. The advantage of interpreted languages is that they're generally easier and you can test and work out bugs more quickly without spending time compiling.

As a trade off, the interpreted languages can take significantly longer to run the same functions. Which isn't a problem on the small scale, but and add up a lot with more complexity.

3

Triabolical_ t1_j27hw5e wrote

The other answers are good but are missing some nuance.

The difference between compiled and interpreted is when the translation operation is done. In compiled languages, the translation is done all at once before the code is shipped, and in interpreted languages, it is done when it is run.

There are hybrid approaches, however.

C# is a compiled language, but it's not compiled to machine code - it's compiled to an intermediate language known as ".NET intermediate language" or ".NET IL". That code is then compiled into machine code on the user's machine, but it's done in small chunks using what's known as a "just in time" compiler, or JIT. Except some code that will get used all the time gets compiled into machine code once to avoid the overhead of doing it all the time.

There are other approaches that compile the language to an intermediate language called "p code", and that p code is interpreted when it is executed.

3

dellive t1_j27ear2 wrote

Compiler converts the code into Machine level language from the first line to the last and then when the program is actually executed, it uses the machine level code. An interpreter converts it to machine level when it runs. Another difference is, compiler will show all errors in the code at once. In case of interpreter, it shows one at a time. I.e. when the interpreter encounters an error, it won’t go to the next line without fixing the error in the current line.

1