aboutsummaryrefslogtreecommitdiff
path: root/src/lang/asm.clj
diff options
context:
space:
mode:
authorEduardo Julian2014-12-07 19:46:57 -0400
committerEduardo Julian2014-12-07 19:46:57 -0400
commit98b427b8835eca42c0ee401a4deb842a9445a737 (patch)
treef70079f05df9f49ffe15c0d3cd15b78232a6cdd2 /src/lang/asm.clj
parent0bccd6a2313dc5eadb635d1fbf02dbb0a5ff2cfe (diff)
Cleaned up a lot of useless code and removed the state monad from the compilation phase (the ASM library already works as a state monad).
Diffstat (limited to 'src/lang/asm.clj')
-rw-r--r--src/lang/asm.clj48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/lang/asm.clj b/src/lang/asm.clj
deleted file mode 100644
index 9f8e542c4..000000000
--- a/src/lang/asm.clj
+++ /dev/null
@@ -1,48 +0,0 @@
-(ns lang.asm
- (:import (org.objectweb.asm Opcodes
- ClassWriter
- MethodVisitor)))
-
-(defn write-file [file data]
- (with-open [stream (java.io.BufferedOutputStream. (java.io.FileOutputStream. file))]
- (.write stream data)))
-
-(comment
- (let [class-data (let [cw (doto (new ClassWriter ClassWriter/COMPUTE_MAXS)
- (.visit Opcodes/V1_5 (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER)
- "hello_world" nil "java/lang/Object" nil))]
- (doto (.visitMethod cw Opcodes/ACC_PUBLIC "<init>" "()V" nil nil)
- (.visitCode)
- (.visitVarInsn Opcodes/ALOAD 0)
- (.visitMethodInsn Opcodes/INVOKESPECIAL "java/lang/Object" "<init>" "()V")
- (.visitInsn Opcodes/RETURN)
- (.visitMaxs 0 0)
- (.visitEnd))
- (doto (.visitMethod cw (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "main" "([Ljava/lang/String;)V" nil nil)
- (.visitCode)
- (.visitFieldInsn Opcodes/GETSTATIC "java/lang/System" "out" "Ljava/io/PrintStream;")
- (.visitLdcInsn "Hello, World!")
- (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/io/PrintStream" "println" "(Ljava/lang/String;)V")
- (.visitInsn Opcodes/RETURN)
- (.visitMaxs 0 0)
- (.visitEnd))
- (.visitEnd cw)
- (.toByteArray cw))]
- (write-file "hello_world.class" class-data))
-
-
- )
-
-;; package asm;
-;; public class HelloWorld {
-;; public static void main(String[] args) {
-;; System.out.println("Hello, World!");
-;; }
-;; }
-
-
-
-
-
-
-