Hi Charlie, thanks for sharing this, it looks most useful. I downloaded and ran it; the testcases run ok. I cannot figure out how to make it write MyClass.class; please forgive me my Ruby-ignorance here. I removed the things I though to be for the testcase only, and have it execute outside of a method. It executes ok, but Erik Meijer would be very happy: there are no side-effects. That I know of.
best regards and thanks in advance. René. On Fri, Oct 10, 2008 at 7:58 PM, Charles Oliver Nutter < [EMAIL PROTECTED]> wrote: > > René Jansen wrote: > > Just a quick question: which assembler are you guys using for > > experimentation? I find myself wanting to try out some things, but I am > > in a bind between ooLong and Jasmin or maybe ASM. Is there an unofficial > > official assembler, preferably something with macros (old s/370 bal > > programmer that I am) and its own disassembler. > > > > I noticed there is a class called Assembler in the tools sources, is > > this only usable from javac or is it addressable in any other way? > > > > If no disassembler goes with the package, I would prefer something that > > is close enough to javap that I can write a small thingy to rearrange > > its output into something that I can assemble - something that ASM can > > but in a very verbose way. > > > > Please let me know what you use. > > I'm using ASM exclusively, but usually wrapped behind one of my own shims. > > Either this super-trivial shim that just exposes a method-per-opcode: > > http://is.gd/3RsP > > Or my unreleased Ruby DSL for ASM, "JVMScript": > > http://kenai.com/projects/jvmscript > > The latter is probably more interesting to you, but obviously has a > dependency on JRuby. Perhaps that's not a problem for your toolchain. > > Here's a short sample: > > builder = Compiler::FileBuilder.build("somefile.source") do > package "org.awesome", "stuff" do > public_class "MyClass", object do > public_field "list", ArrayList > > public_constructor string, ArrayList do > aload 0 > invokespecial object, "<init>", [void] > aload 0 > aload 1 > aload 2 > invokevirtual this, "bar", [ArrayList, string, ArrayList] > aload 0 > swap > putfield this, "list", ArrayList > returnvoid > end > > public_static_method "foo", this, string do > new this > dup > aload 0 > new ArrayList > dup > invokespecial ArrayList, "<init>", [void] > invokespecial this, "<init>", [void, string, ArrayList] > areturn > end > > public_method "bar", ArrayList, string, ArrayList do > aload 1 > invokevirtual(string, "toLowerCase", string) > aload 2 > swap > invokevirtual(ArrayList, "add", [boolean, object]) > aload 2 > areturn > end > > public_method("getList", ArrayList) do > aload 0 > getfield this, "list", ArrayList > areturn > end > > public_static_method("main", void, string[]) do > aload 0 > ldc_int 0 > aaload > invokestatic this, "foo", [this, string] > invokevirtual this, "getList", ArrayList > aprintln > returnvoid > end > end > end > end > > - Charlie > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---