Forum: JRuby [ANN] BiteScript 0.0.1 - a DSL for JVM bytecode

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Charles Oliver N. (Guest)
on 2009-03-28 21:13
(Received via mailing list)
BiteScript is a Ruby DSL for generating JVM bytecode and classes. It is
used by the Duby programming language and by the upcoming "compiler2"
Ruby-to-Java compiler in JRuby.

Project page: http://kenai.com/projects/jvmscript

Install: gem install bitescript

Dependencies: JRuby 1.2 or higher

Changes:

* First public release. Most features up to Java 1.4 are supported plus
Java 5 annotations.

Sample code:

require 'bitescript'

include BiteScript

fb = FileBuilder.build(__FILE__) do
   public_class "SimpleLoop" do
     public_static_method "main", void, string[] do
       aload 0
       push_int 0
       aaload
       label :top
       dup
       aprintln
       goto :top
       returnvoid
     end
   end
end

fb.generate do |filename, class_builder|
   File.open(filename, 'w') do |file|
     file.write(class_builder.generate)
   end
end


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Stephen B. (Guest)
on 2009-03-29 19:09
(Received via mailing list)
>BiteScript is a Ruby DSL for generating JVM bytecode and classes. It is
>used by the Duby programming language and by the upcoming "compiler2"
>Ruby-to-Java compiler in JRuby.
>
>Project page: http://kenai.com/projects/jvmscript
>
>Install: gem install bitescript
>


Cool,

I tried to run this from the command line:

$ jruby examples/mixed_bag.rb
examples/mixed_bag.rb:3:in `require': no such file to load --
bitescript (LoadError)
  from examples/mixed_bag.rb:3

I had to use the '-rubygems' parameter for JRuby:

[jvmscript-hg]$ jruby -rubygems examples/mixed_bag.rb
[hello, bitescript]
jruby examples.miced

I've got RUBYOPT set:

$ echo $RUBYOPT
rubygems

But evidently RUBYOPT is still not supported in JRuby:

   http://jira.codehaus.org/browse/JRUBY-937

or in jirb:

$ jirb
irb(main):001:0> require 'java'
=> false
irb(main):002:0> require 'jruby'
=> false
irb(main):003:0> require 'bitescript'
LoadError: no such file to load -- bitescript
  from (irb):4:in `require'
  from (irb):4

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Charles Oliver N. (Guest)
on 2009-03-29 20:03
(Received via mailing list)
Stephen B. wrote:
> But evidently RUBYOPT is still not supported in JRuby:
>
>   http://jira.codehaus.org/browse/JRUBY-937

Yes, I started implementing RUBYOPT in the 1.2 cycle, but it turned out
to be more complicated than I expected. Instead of simply being able to
add RUBYOPT env vars to the command line in our bash script, we need to
actually pass them through to the full Ruby argument processing. It also
needs to be able to accept arguments with no - in front, so it's
somewhat different from normal arg processing.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.