JavaScript what language is it? interpretable or compiled?
- there are interpreters, there are compilers. - Grundy
- Can compilers execute translated machine code? - Serik Shaikamalov
- compilers do nothing - Grundy
- Can I link to the documentation? - Serik Shaikamalov
- Since the same language can have both a compiler and an interpreter, it is better to speak not about the compiled / interpreted language, but about a specific implementation of the language - dSH
2 answers
Interpreter - a program that executes the source code according to the instructions (inline).
Compiler - a program that analyzes and translates the source code into a computer programming language and executes it .
- oneCan compilers execute translated machine code? - Serik Shaikamalov am
- 2> and executes it. - Alexey Kapustsin
- four@Developer Code execution is not part of the compiler task. Moreover, the machine code is executed directly by the processor. But the program itself, which includes a compiler, can start it immediately after compilation. Although everything is much more complicated, the compiler does not necessarily do exactly the machine code, it can do some kind of intermediate code that someone else will execute - Mike
- oneThank you all for the additions! - Serik Shaikamalov
- The compiler can make the code that the interpreter will execute. Probably in some sense, the computer processor can be considered an interpreter. It turns out that the interpreter is the execution platform, and the compiler is the program for generating code for this platform from other code. - rusnasonov
JavaScript refers to dynamically translated languages ​​(JIT - Just-In-Time). Those. it is first run in interpreted mode, and then compiled into native code (i.e., code executed by the processor itself).
In general, the difference between the compiler and the interpreter is rather blurred, but in general it can be considered that the main task of the compiler is to translate the program into an assembler or immediately executable code of the target processor. The task of the interpreter is to translate into an intermediate code for execution by the virtual machine. Dynamic (jit) compilers are some mixture of these two types of translation.