解析haskell中的java类文件 [英] Dissecting java Class file in haskell
问题描述
我最近刚刚在今年早些时候开始学习Haskell语言,并且正在处理一个输入java类文件(即FileName1.class)的项目,并解析该文件以打印出以下内容:
- 类文件定义的类名称
- 类的方法数量,它们的名称和类型
我做了一些研究,发现这可以通过使用JVM来实现,但是在这个过程中有点遗失,任何人都会对如何解决你需要为Java类格式编写解析器。
$ b $解析方案
b
幸运的是,已经有库可以做到这一点。
解析文件,在生成的AST文件中,打印所需的信息。
I just recently started learning the Haskell language earlier this year and am working on a project that inputs a java class file (i.e FileName1.class) and dissect that file to print out the following:
- name of the class defined by the class file
- the number of methods of the class, their names and types
I did some research and found that this is possible by using a JVM but am a little lost in the process, anyone have any suggestions on how to tackle this?
You need to write a parser for the Java class format.
Luckily there are already libraries to do that.
Parse the file, inpsect the AST generated, print the required information.
这篇关于解析haskell中的java类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!