Project

julializer

0.01
No commit activity in last 3 years
No release in over 3 years
A ruby2julia transpiler with only limited types of syntax conversion supported
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

A ruby2julia transpiler made with ❤️.

Requirement

Ruby(MRI) 1.9.3 and up

Installation

$ gem install julializer

Usage

From your codebase:

require 'julializer'
Julializer.ruby2julia("3.5.round") # round(Int64,3.5)

Available from CLI too:

$ echo echo -1.6.to_i | julializer
trunc(Int64,parse(string((-1.6))));
$ cat sample.rb
for i in 0..list.size-1
  list[i] = (i-list.size/2).abs
end
$ julializer sample.rb
for i::Int64 = 0:size(list)[1]-1;list[i+1]=abs((i-size(list)[1]/2));;end;;

Supported Classes and Syntax

As of v0.1.0, very limited number of classes and methods are supported as shown below.

  • Supported Classes
    • Most methods are available
      • TrueClass, FalseClass, Fixnum, Float, integer, Numeric, Random
    • Very limited methods are available
      • Array, Range, Hash
  • Supported Modules
    • Math
  • Supported Syntax
    • def
    • while, next, for, if..elsif..end
    • global variable, constant

But there are very many differences between Ruby and Julia which I have no idea how to fix as of now. For example:

  • Julia doesn't have Class concept(there is workaround though) but Ruby does
  • Julia does not have a "null" value but Ruby does
    • For example in Ruby [1,2,3].slice!(4) will return null but in julia there is no nil therefore this raises causes error.
    • Current workaround for this is, do not write this way, instead you need to check boundary by yourself.
  • And many more gaps to be solved
    • e.g.) In Julia typemax() and typemin() returns Inf but in Ruby Float::MAX, Float::MIN have specific value

For more information about what methods are available in detail, I'm still on a way to write spec and documentation. If anyone out there would want it early, it'd be more than helpful if you can join us by opening new issues for example. Your contribution is more than welcome all the time.

License

MIT