palmr / classfile-parser Goto Github PK
View Code? Open in Web Editor NEW:coffee: A parser for Java Classfiles written in rust
Home Page: https://crates.io/crates/classfile-parser
License: MIT License
:coffee: A parser for Java Classfiles written in rust
Home Page: https://crates.io/crates/classfile-parser
License: MIT License
nom, the main library this project is based on, has release version 4.0 which we should upgrade to.
They have information on upgrading from previous versions to help with breaking changes.
Relevant Reference: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.4
The VerificationTypeInfo
in src/attribute_info/types.rs only parses the tags of the code, and ignores the data that would come after it (only two variants have it).
Currently almost everything is public, which isn't great.
The only way to parse your own byte array requires calling the parsing code yourself and dealing with the result from nom, which leaks parsing implementation details outside of the crate.
There should probably be some more top level functions in lib for parsing from paths, jars, byte arrays etc.
Structs for the public data types should be together rather than scattered about.
Parsers should be together and non-public.
A parser is required for LocalVariableTypeTable attributes
https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.14
I would like to use this library, but it has no license. Could you provide a license for the code?
A parser is required for SourceFile attributes
https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.10
A parser is required for LocalVariableTable attributes
https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.13
At the moment, the code parser is not tested against all opcodes. Ideally, we can reuse an existing corpus of opcodes to test our implementation.
Could class files be written, as well as parsed, via serde and serde-bytes ?
I could work on this...
I was using this as a dependency and wanted to confirm if the project was still supported.
Hey is this project dead?
I want to use it in my project to write a full virtual machine (with cranelift backend) in rust.
But I need all features in README.md.
Now that the parsing of valid Java strings works as expected (thanks!), I discovered an other issue: Java supports unpaired surrogates (U+D800
to U+DFFF
). They aren't officially allowed, which is why Rust does not support them. However, some Java libraries use them to encode binary data (e.g. libgcj). At the moment, class_parser
is unable to handle such classes because the decoding error is propagated back to it.
Possible solutions:
utf8_string
to Result<String, Vec<u8>>
and let the user decide (e.g. apply String::from_utf8_lossy
)String::from_utf8_lossy
ourselvesA parser is required for LineNumberTable attributes
https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.12
A parser is required for BootstrapMethods attributes
https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.23
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.