Parser for JVM classfiles, built upon the parser combinator library attoparsec. Classfile versions targeted for correct parsing are the same as of JDK for Java SE 17: 45 - 61 (which corresponds to Java SE 1.0.2 - 17).
This software is still in early development and not ready for serious usage yet. Development is mainly happening on the dev branch
Oktade is able to parse and write entire classfiles correctly, however some things still need to be worked on:
- Finish Argument parsing. Currently, many arguments are represented as
bytestrings in their most general form possible.
- Bytecode parsing.
- Attribute validation: disallow multiple attributes of the same type if the type only allows one instance per classfile
- Signature string parsing. Currently, signatures are stored as bytestrings.
- MUTF-8 decoding and encoding. (If that is even necessary, did not have any issues with that so far...)
- Implement operations for modifying the classfile/bytecode.
The main executable can be used in a similar fashion to javap
: Run
./oktade <classfile>
to have the parsed classfile printed out.
A working installation of Haskell (GHC 8.10.7 or more recent) and cabal (3.6.2.0 or more recent). The easiest way of obtaining those is using GHCup.
During development, try maintaining compatability with the GHC version marked as 'recommended' in GHCup (currently GHC 8.10.7).
Clone this project via git clone https://github.com/Trattue/oktade
or using
your git client.
Run cabal build
to produce executables of all targets. This will produce
executables of the main application, the test application and the benchmark
application.
For testing, run cabal test --test-show-details=direct
afterwards.
For benchmarking, run cabal bench
. This will benchmark oktade parsing and
unparsing every classfile in the cfr-tests project for 200 iterations (after a
warmup of 10 iterations). You can find more information on how the benchmark
works in the files in the testsuite/benchmarks/ folder.
Use the ormolu formatter; maximum line length is 80 (except for stuff like URIs). Make sure to follow all of hlint's suggestions.
For the .cabal file, use cabal format
.
Copyright (c) 2021 Trattue
Oktade is distributed under the terms of the Apache License (Version 2.0), see LICENSE for details.
The oktade repository includes code from other projects which may be licensed under other terms and conditions:
- cfr_tests: Licensed under the MIT
License license (see testsuite/tests/LICENSE for
details).
Compiled classes from the project can be found in the testsuite/tests/ directory.
Thanks to the CFR developers for making their comprehensive test suite open source!
Additionally, this project uses third party libraries. You can find a list of those in the .cabal file. While building oktade, your compiler may link those libraries to oktade; please check their corresponding licenses for legal infomation, e.g. regarding distribution of binaries.