Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bronsa/tools.decompiler
A decompiler for clojure, in clojure
https://github.com/bronsa/tools.decompiler
clojure decompiler
Last synced: 14 days ago
JSON representation
A decompiler for clojure, in clojure
- Host: GitHub
- URL: https://github.com/bronsa/tools.decompiler
- Owner: Bronsa
- License: epl-1.0
- Created: 2017-07-14T22:25:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-27T10:43:34.000Z (over 1 year ago)
- Last Synced: 2024-12-16T07:09:03.491Z (18 days ago)
- Topics: clojure, decompiler
- Language: Clojure
- Homepage:
- Size: 864 KB
- Stars: 70
- Watchers: 7
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
I gave a talk on tools.decompiler at Clojure/Conj in October 2017. Video [here](https://www.youtube.com/watch?v=2SGFeegEt9E)
# Dependencies:
Leiningen:
```clojure
[bronsa/tools.decompiler "0.1.0-alpha1"]
```# Usage:
Use `lein javac` to AOT compile `clojure.tools.decompiler.RetrieveClasses` then you can use `lein repl` or `clj` to launch a repl
Use `decompile-classfiles `to decompile AOT compiled classes:
```clojure
user=> (require '[clojure.tools.decompiler :as d])
nil
user=> (d/decompile-classfiles {:input-path "path/to/root/classes/directory" :output-path "path/to/src"})
;; with no :output-path, decompile to stdout
[...]
```You can use `decompile-classes` to decompile in memory classes, but to do so you must start the JVM using the java agent provided with `tools.decompiler` (use e.g. `lein jar` to build the jar):
```clojure
[~/src/tools.decompiler] clj -J-javaagent:tools.decompiler.jar
user=> (require '[clojure.tools.decompiler :as d])
nil
user=> (defn foo [a] a)
#'user/foo
user=> (decompile-classes {:classes #{"user$foo"}}) ;; optionally :output-path to decompile to disk
Decompiling user$foo
(fn foo
([a] a)
nil
```