Code Monkey home page Code Monkey logo

chasm's Introduction

Chasm - Java assembler and disassembler using S-expressions

Chasm can disassemble *.class files and *.jar files and output assembly in s-expression form. Furthermore the main use case is to read s-expression assembly files and output *.class or *.jar files. The s-expression syntax is both easy to parse and easy to generate. Chasm uses the de-facto standard library ow2 ASM for bytecode generation. Since Chasm is only a minimal syntax on top of ASM it is easy to keep it up to date with the current bytecode standard.

(class 53 (final public super) chasm/Main null java/lang/Object ()
 (source "Main.java" null)
 (inner-class chasm/Server$Command chasm/Server Command (abstract interface public static))
 (inner-class java/lang/invoke/MethodHandles$Lookup java/lang/invoke/MethodHandles Lookup (final public static))
 (method (public static) main "([Ljava/lang/String;)V" null (java/io/IOException)
  (code
   (label L0)
   (line 13 L0)
   (invokedynamic run "()Lchasm/Server$Command;"
    (H invokestatic java/lang/invoke/LambdaMetafactory metafactory
     "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;" false)
    ((T "(Ljava/nio/file/Path;[Ljava/lang/String;Ljava/io/PrintStream;)V")
     (H invokestatic chasm/Main run
      "(Ljava/nio/file/Path;[Ljava/lang/String;Ljava/io/PrintStream;)V" false)
     (T "(Ljava/nio/file/Path;[Ljava/lang/String;Ljava/io/PrintStream;)V")))
   (aload 0)
   (invokestatic chasm/Server main "(Lchasm/Server$Command;[Ljava/lang/String;)V")
   (label L1)
   (line 14 L1)
   (return)
   (label L2)
   (local args "[Ljava/lang/String;" null L0 L2 0)
   (maxs 2 1)))
...

See example.chasm for the full example.

Quick start

  1. Build with gradle or use the precompiled binary in dist (reproducible build).

  2. Disassemble class/jar file to chasm with chasm example.{class|jar} example.chasm

  3. Assemble chasm to class/jar file with chasm example.chasm example.{class|jar}

Binary version

The 'dist' directory contains a precompiled version which includes a copy of ASM.

License

MIT (c) 2018 Daniel Mendler

ASM: a very small and fast Java bytecode manipulation framework Copyright (c) 2000-2011 INRIA, France Telecom All rights reserved.

chasm's People

Contributors

minad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chasm's Issues

error when assemble chasm

I got got this error when I try assemble chasm:

Exception in thread "main" chasm.SExpParser$SExpException: Expected SYM, but got INT:-17 at line 79
at chasm.SExpParser.err(SExpParser.java:275)
at chasm.SExpParser.err(SExpParser.java:271)
at chasm.SExpParser.expect(SExpParser.java:157)
at chasm.SExpParser.sym(SExpParser.java:56)
at chasm.ClassParser.parseCodeInsn(ClassParser.java:418)
at chasm.ClassParser.parseCode(ClassParser.java:286)
at chasm.ClassParser.parseMethod(ClassParser.java:229)
at chasm.ClassParser.read(ClassParser.java:86)
at chasm.Pipeline.run(Pipeline.java:55)
at chasm.Pipeline.process(Pipeline.java:47)
at chasm.Main.run(Main.java:38)
at chasm.Server.main(Server.java:37)
at chasm.Main.main(Main.java:13)

Any idea ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.