gpt4 book ai didi

java - 字节码java虚拟机

转载 作者:行者123 更新时间:2023-12-01 23:15:56 26 4
gpt4 key购买 nike

我们的项目是为我们的语法(miniJava)创建中间代码。到目前为止,我们使用 antlr 为其构建词法分析器和解析器。现在对于中间代码我们应该使用字节码。谁能帮助我理解什么是字节码以及我们应该做什么来使用它? 我在网上搜索过,没有太多关于此案例的资源。

最佳答案

The Java® Virtual Machine Specification

在文档中,字节码通常被描述为指令

Chapter 6 specifies the instruction set of the Java Virtual Machine, presenting the instructions in alphabetical order of opcode mnemonics.

Chapter 6. The Java Virtual Machine Instruction Set

A Java Virtual Machine instruction consists of an opcode specifying the operation to be performed, followed by zero or more operands embodying values to be operated upon. This chapter gives details about the format of each Java Virtual Machine instruction and the operation it performs.

完整字节码列表:Instructions

4.10.1.3. Instruction Representation

Individual bytecode instructions are represented in Prolog as terms whose functor is the name of the instruction and whose arguments are its parsed operands.

For example, an aload instruction is represented as the term aload(N), which includes the index N that is the operand of the instruction.

其他资源

关于java - 字节码java虚拟机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21218533/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com