编译语言和解释语言有什么区别? [英] What's the difference between compiled and interpreted language?

查看:150
本文介绍了编译语言和解释语言有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读了关于这个主题的一些材料之后,我仍然不确定编译语言和解释语言之间的区别是什么。我被告知这是Java和JavaScript之间的差异之一。有人请帮我理解吗?

After reading some material on this subject I'm still not sure what the difference between a compiled language and an interpreted language is. I was told this is one of the differences between Java and JavaScript. Would someone please help me in understanding it?

推荐答案


编译语言和解释语言有什么区别?

What’s the difference between compiled and interpreted language?

该语言的区别在于不是;它位于实现

The difference is not in the language; it is in the implementation.

从我的系统中得到了这个,这是一个答案:

Having got that out of my system, here's an answer:


  • 在编译实现中,原始程序被翻译成本机机器指令,由硬件直接执行。

  • In a compiled implementation, the original program is translated into native machine instructions, which are executed directly by the hardware.

在解释的实现中,原始程序被翻译成其他内容。另一个名为解释器的程序然后检查别的东西并执行所要求的任何动作。根据语言及其实现,有各种形式的别的东西。从更受欢迎到不太受欢迎,别的东西可能是

In an interpreted implementation, the original program is translated into something else. Another program, called "the interpreter", then examines "something else" and performs whatever actions are called for. Depending on the language and its implementation, there are a variety of forms of "something else". From more popular to less popular, "something else" might be


  • 虚拟机的二进制指令,通常称为字节码,就像在Lua,Python,Ruby,Smalltalk和许多其他系统中所做的那样(该方法在20世纪70年代由UCSD P系统和UCSD Pascal推广)

  • Binary instructions for a virtual machine, often called bytecode, as is done in Lua, Python, Ruby, Smalltalk, and many other systems (the approach was popularized in the 1970s by the UCSD P-system and UCSD Pascal)

原始程序的树状表示,例如抽象语法树,就像为许多原型或教育口译员所做的那样

A tree-like representation of the original program, such as an abstract-syntax tree, as is done for many prototype or educational interpreters

源程序的标记化表示,类似于Tcl

A tokenized representation of the source program, similar to Tcl

源程序的字符,如在MINT和TRAC中所做的那样

The characters of the source program, as was done in MINT and TRAC

使问题复杂化的一件事是有可能将(编译)字节码转换为本机机器指令。因此,成功的整合实现可能最终获得编译器。如果编译器在后台动态运行,它通常被称为即时编译器或JIT编译器。 JIT是为Java,JavaScript,Lua开发的,我敢说其他许多语言。那时你可以有一个混合实现,其中一些代码被解释,一些代码被编译。

One thing that complicates the issue is that it is possible to translate (compile) bytecode into native machine instructions. Thus, a successful intepreted implementation might eventually acquire a compiler. If the compiler runs dynamically, behind the scenes, it is often called a just-in-time compiler or JIT compiler. JITs have been developed for Java, JavaScript, Lua, and I daresay many other languages. At that point you can have a hybrid implementation in which some code is interpreted and some code is compiled.

这篇关于编译语言和解释语言有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆