是Javascript编译还是解释语言?

时间:2021-02-22 20:43:22

Can Javascript be called a pure interpreted language? Or does it also have some compiled flavor to it? Could someone guide at the reasons behind both the things whichever being true.

Javascript可以被称为纯粹的解释语言吗?或者它也有一些编译风味吗?有人可以指出两者背后的原因,无论哪个是真的。

2 个解决方案

#1


50  

Go and read the answers to this question

去阅读这个问题的答案

https://softwareengineering.stackexchange.com/questions/138521/is-javascript-interpreted-by-design

https://softwareengineering.stackexchange.com/questions/138521/is-javascript-interpreted-by-design

The answer I accepted is excellent and should help answer your question.

我接受的答案很好,应该有助于回答你的问题。

For me personally, I am somewhat cautious of the idea of calling a language interpreted or compiled. It's an implementation decision, not part of the language specification. If you want to talk about compiled or interpreted JavaScript, ask it in the context of an actual implementation of the language specification.

就我个人而言,我对调用或编译语言的想法有点谨慎。这是一个实现决策,不是语言规范的一部分。如果您想谈论编译或解释的JavaScript,请在​​语言规范的实际实现的上下文中询问它。

#2


14  

JavaScript is interpreted at runtime by the client browser. There is a tool called the Rhino JavaScript Compiler that supposedly compiles JavaScript into Java class files, though.

客户端浏览器在运行时解释JavaScript。但是有一个名为Rhino JavaScript Compiler的工具可以将JavaScript编译成Java类文件。

#1


50  

Go and read the answers to this question

去阅读这个问题的答案

https://softwareengineering.stackexchange.com/questions/138521/is-javascript-interpreted-by-design

https://softwareengineering.stackexchange.com/questions/138521/is-javascript-interpreted-by-design

The answer I accepted is excellent and should help answer your question.

我接受的答案很好,应该有助于回答你的问题。

For me personally, I am somewhat cautious of the idea of calling a language interpreted or compiled. It's an implementation decision, not part of the language specification. If you want to talk about compiled or interpreted JavaScript, ask it in the context of an actual implementation of the language specification.

就我个人而言,我对调用或编译语言的想法有点谨慎。这是一个实现决策,不是语言规范的一部分。如果您想谈论编译或解释的JavaScript,请在​​语言规范的实际实现的上下文中询问它。

#2


14  

JavaScript is interpreted at runtime by the client browser. There is a tool called the Rhino JavaScript Compiler that supposedly compiles JavaScript into Java class files, though.

客户端浏览器在运行时解释JavaScript。但是有一个名为Rhino JavaScript Compiler的工具可以将JavaScript编译成Java类文件。