编译为java字节码(不使用Java) [英] Compile to java bytecode (without using Java)

查看:138
本文介绍了编译为java字节码(不使用Java)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的编译器类正在创建一个我们打算编译到Java字节码的语言。



我们在定位有关如何从我们的编译器创建.class文件的信息时遇到问题。你有什么资源可以给我们一些帮助吗?我们已经有很多有关指令集的文档,但需要有关如何直接填写类文件/写入hex的信息。



我们不需要信息或建议反编译.class文件。



即使是一个从头开始写出一个.class文件的简单例子也不错。


$ b

$ b

解决方案

VM规格:类文件格式 Java虚拟机指令集应该这样做。



您可以查看字节代码工程库( BCEL )以获得一些灵感,以及 Findbugs (它必须读/理解类文件)。


My compilers class is creating a language that we intend to compile to Java Bytecode. We have made plenty of progress and are nearing the time where it's time for code generation.

We are having problems locating information on how to create .class files from our compiler. Do you have any resources that can give us some assistance? We already have plenty of documentation on the instruction set, but need information on how to directly fill out the class file/the writing of hex.

We do not need information or suggestions on decompiling the .class files.

Even a simple example of writing out a .class file from scratch would be excellent.

The JVM spec is not what we're after. What we really need is an example or a walkthrough.

解决方案

The VM Spec: The Class File Format and the The Java Virtual Machine Instruction Set should do it.

You might look at the Byte Code Engineering Library (BCEL) for some inspiration as well as Findbugs (it has to read/understand class files).

这篇关于编译为java字节码(不使用Java)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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