• <legend id='7PF31'><style id='7PF31'><dir id='7PF31'><q id='7PF31'></q></dir></style></legend>

    <small id='7PF31'></small><noframes id='7PF31'>

      1. <tfoot id='7PF31'></tfoot>
          <bdo id='7PF31'></bdo><ul id='7PF31'></ul>
        <i id='7PF31'><tr id='7PF31'><dt id='7PF31'><q id='7PF31'><span id='7PF31'><b id='7PF31'><form id='7PF31'><ins id='7PF31'></ins><ul id='7PF31'></ul><sub id='7PF31'></sub></form><legend id='7PF31'></legend><bdo id='7PF31'><pre id='7PF31'><center id='7PF31'></center></pre></bdo></b><th id='7PF31'></th></span></q></dt></tr></i><div id='7PF31'><tfoot id='7PF31'></tfoot><dl id='7PF31'><fieldset id='7PF31'></fieldset></dl></div>

        Java“虚拟机"vs. Python“解释器"用语?

        时间:2023-08-25

            • <small id='kV37K'></small><noframes id='kV37K'>

                <i id='kV37K'><tr id='kV37K'><dt id='kV37K'><q id='kV37K'><span id='kV37K'><b id='kV37K'><form id='kV37K'><ins id='kV37K'></ins><ul id='kV37K'></ul><sub id='kV37K'></sub></form><legend id='kV37K'></legend><bdo id='kV37K'><pre id='kV37K'><center id='kV37K'></center></pre></bdo></b><th id='kV37K'></th></span></q></dt></tr></i><div id='kV37K'><tfoot id='kV37K'></tfoot><dl id='kV37K'><fieldset id='kV37K'></fieldset></dl></div>
                <legend id='kV37K'><style id='kV37K'><dir id='kV37K'><q id='kV37K'></q></dir></style></legend>
              • <tfoot id='kV37K'></tfoot>

                  <bdo id='kV37K'></bdo><ul id='kV37K'></ul>

                    <tbody id='kV37K'></tbody>
                  本文介绍了Java“虚拟机"vs. Python“解释器"用语?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 Java 中一直使用虚拟机"时,似乎很少阅读 Python虚拟机".

                  It seems rare to read of a Python "virtual machine" while in Java "virtual machine" is used all the time.

                  两者都解释字节码;为什么叫一个虚拟机,另一个叫解释器?

                  Both interpret byte codes; why call one a virtual machine and the other an interpreter?

                  推荐答案

                  虚拟机是一种虚拟计算环境,具有一组特定的原子定义明确的指令,这些指令不受任何特定语言的支持,通常被认为是沙箱本身.VM 类似于特定 CPU 的指令集,并且倾向于在更基本的级别上工作,这些指令(或字节码)的非常基本的构建块独立于下一个.一条指令仅根据虚拟机的当前状态确定性地执行,而不依赖于该时间点指令流中其他地方的信息.

                  A virtual machine is a virtual computing environment with a specific set of atomic well defined instructions that are supported independent of any specific language and it is generally thought of as a sandbox unto itself. The VM is analogous to an instruction set of a specific CPU and tends to work at a more fundamental level with very basic building blocks of such instructions (or byte codes) that are independent of the next. An instruction executes deterministically based only on the current state of the virtual machine and does not depend on information elsewhere in the instruction stream at that point in time.

                  另一方面,解释器更复杂,因为它专门用于解析某些语法流,这些语法属于特定语言和特定语法,必须在周围标记的上下文中解码.您不能孤立地查看每个字节甚至每一行,并确切地知道下一步该做什么.不能像相对于 VM 的指令(字节码)那样孤立地使用语言中的标记.

                  An interpreter on the other hand is more sophisticated in that it is tailored to parse a stream of some syntax that is of a specific language and of a specific grammer that must be decoded in the context of the surrounding tokens. You can't look at each byte or even each line in isolation and know exactly what to do next. The tokens in the language can't be taken in isolation like they can relative to the instructions (byte codes) of a VM.

                  Java 编译器将 Java 语言转换为字节码流,这与 C 编译器将 C 语言程序转换为汇编代码没有什么不同.另一方面,解释器并不真正将程序转换为任何定义明确的中间形式,它只是将程序动作作为解释源代码的过程.

                  A Java compiler converts Java language into a byte-code stream no different than a C compiler converts C Language programs into assembly code. An interpreter on the other hand doesn't really convert the program into any well defined intermediate form, it just takes the program actions as a matter of the process of interpreting the source.

                  VM 和解释器之间区别的另一个测试是您是否认为它是独立于语言的.我们所知道的 Java VM 并不是真正的 Java 特定的.您可以使用其他语言制作编译器,生成可以在 JVM 上运行的字节码.另一方面,我认为我们不会真正考虑将 Python 以外的其他语言编译"成 Python 以供 Python 解释器进行解释.

                  Another test of the difference between a VM and an interpreter is whether you think of it as being language independent. What we know as the Java VM is not really Java specific. You could make a compiler from other languages that result in byte codes that can be run on the JVM. On the other hand, I don't think we would really think of "compiling" some other language other than Python into Python for interpretation by the Python interpreter.

                  由于解释过程的复杂性,这可能是一个相对缓慢的过程......特别是解析和识别语言标记等,并了解源的上下文以便能够在口译员.为了帮助加速此类解释语言,我们可以在这里定义更容易直接解释的预解析、预标记源代码的中间形式.这种二进制形式仍然在执行时被解释,它只是从一种人类可读性差得多的形式开始以提高性能.但是,执行该表单的逻辑不是虚拟机,因为这些代码仍然不能孤立地看待 - 周围令牌的上下文仍然很重要,它们只是现在处于一种不同的计算机效率更高的形式.

                  Because of the sophistication of the interpretation process, this can be a relatively slow process....specifically parsing and identifying the language tokens, etc. and understanding the context of the source to be able to undertake the execution process within the interpreter. To help accelerate such interpreted languages, this is where we can define intermediate forms of pre-parsed, pre-tokenized source code that is more readily directly interpreted. This sort of binary form is still interpreted at execution time, it is just starting from a much less human readable form to improve performance. However, the logic executing that form is not a virtual machine, because those codes still can't be taken in isolation - the context of the surrounding tokens still matter, they are just now in a different more computer efficient form.

                  这篇关于Java“虚拟机"vs. Python“解释器"用语?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:JVM HotSpot 上的 Java 异常计数器 下一篇:什么是堆栈图框

                  相关文章

                  <i id='WJ94A'><tr id='WJ94A'><dt id='WJ94A'><q id='WJ94A'><span id='WJ94A'><b id='WJ94A'><form id='WJ94A'><ins id='WJ94A'></ins><ul id='WJ94A'></ul><sub id='WJ94A'></sub></form><legend id='WJ94A'></legend><bdo id='WJ94A'><pre id='WJ94A'><center id='WJ94A'></center></pre></bdo></b><th id='WJ94A'></th></span></q></dt></tr></i><div id='WJ94A'><tfoot id='WJ94A'></tfoot><dl id='WJ94A'><fieldset id='WJ94A'></fieldset></dl></div>
                    • <bdo id='WJ94A'></bdo><ul id='WJ94A'></ul>
                  1. <tfoot id='WJ94A'></tfoot>

                      <small id='WJ94A'></small><noframes id='WJ94A'>

                      <legend id='WJ94A'><style id='WJ94A'><dir id='WJ94A'><q id='WJ94A'></q></dir></style></legend>