Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upQuestion about the compiler #227
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
getify
Dec 2, 2015
Contributor
This is not really a support forum, but briefly...
JS has to be processed (aka "compiled") first before execution because some of the language mechanics require early errors (that is, compile-time errors) if certain conditions are found in the code, such as:
"use strict";
function foo( x, x ) { .. } // duplicate param name not allowed in strict modeSome syntax errors technically could be caught if the code only went through a quick tokenization scan (not full parsing/compilation), but other situations like that one above require actually understanding the structure of the program to know if something is valid or not.
|
This is not really a support forum, but briefly... JS has to be processed (aka "compiled") first before execution because some of the language mechanics require early errors (that is, compile-time errors) if certain conditions are found in the code, such as: "use strict";
function foo( x, x ) { .. } // duplicate param name not allowed in strict modeSome syntax errors technically could be caught if the code only went through a quick tokenization scan (not full parsing/compilation), but other situations like that one above require actually understanding the structure of the program to know if something is valid or not. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ljharb
Dec 2, 2015
Member
The words "compiled" and "interpreted" technically refer to implementations, and as such, every single language could be compiled or interpreted.
However, the way they're most commonly used, I would classify JS as an interpreted language (not compiled), and C++ as a compiled language, for example.
It really just depends on how pedantic you want to be about the definitions - if you stick with the most precise definition, no language is either, only an implementation is one or the other.
|
The words "compiled" and "interpreted" technically refer to implementations, and as such, every single language could be compiled or interpreted. However, the way they're most commonly used, I would classify JS as an interpreted language (not compiled), and C++ as a compiled language, for example. It really just depends on how pedantic you want to be about the definitions - if you stick with the most precise definition, no language is either, only an implementation is one or the other. |
italoacasas commentedDec 2, 2015
Hi Guys, I'know maybe this it is not the correct place tu put this question but I don't find a good place anywhere.
Why JavaScript is not a interpreter language?
Why JavaScript is a "compiler" language?