Wonderful. I wanted to benchmark a Java version against my OCaml/LLVM and
F#/CIL versions. Thanks!
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
Looking forward to seeing that and other comparisons! We shall band
together to make sure BF/JVM is the fastest BF in the world!
- Charlie
Any particularly interesting things you learned from the exercise?
- Charlie
I will surely advertise that fact in my forthcoming BF for Scientists book
which will cover ANSI BF in detail.
SlocCount says this is 66k lines of code. Is that really right?
I cannot even get it to run:
$ export
CLASSPATH="/home/jdh30/src/bfj-read-only/bfj/lib/asm-3.1.jar:/home/jdh30/src/bfj-read-only/bfj/src/"
$ java bf.runner.ParseCompileRunner
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at bf.runner.ParseCompileRunner.main(ParseCompileRunner.java:16)
Sounds like it is failing because it assumed argvs would contain a BF program
to run, i.e. the compiler is actually running. But:
$ java bf.runner.ParseCompileRunner ../bf/mandelbrot.b
compile and run: ../bf/mandelbrot.b
Exception in thread "main" java.lang.NoClassDefFoundError:
bf/util/BrainfuckParser
at bf.runner.ParseCompileRunner.main(ParseCompileRunner.java:20)
Caused by: java.lang.ClassNotFoundException: bf.util.BrainfuckParser
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 1 more
Sounds like the generated code doesn't run. Does it use Windows specific
invocations internally?
I figured out why there is so much Java code in there: the bfj distro contains
some precompiled BF programs as Java source. Removing those, it is only 1,588
LOC. Still 11x longer than the OCaml/LLVM though...
http://lolcode.com/examples/gimmeh
Better yet would be a Java-to-LOLCode xlator! ;-)
Jim