Rubi is a high-level, high-performance script programming language, with syntax that is familiar to users of Ruby. Rubi is implemented via just-in-time compilation.
Anyone who is familiar to Ruby programming language should learn Rubi quickly.
Sample programs can be found in the directory progs.
- Syntax
# Statement => write in the function.# output the string and number# puts is output and \n# output is output only.puts"Hello world!!"# => Hello world!!\nputs"number = ",65536# => number = 65536\noutput"not new line"# => not new line# declaration is not required# support only integeri=10i=i + 43i=i % 5i=i - 32sum=i * (12 / 5)12 / 5# => 2# loop and iffori=1,i < 100,i= i + 1ifi % 15 == 0puts"fizzbuzz"elsifi % 5 == 0puts"buzz"elsifi % 3 == 0puts"fizz"elseputsiendend# create function# return is not support...defsum(n)sm=0fori =1,i <= n,i= i + 1sm=sm + i
endsmend- Implement Fibonacci in Rubi:
deffib(n)ifn < 21elsefib(n - 1) + fib(n - 2)endendputsfib(39)Rubi is freely redistributable under the two-clause BSD License.
Use of this source code is governed by a BSD-style license that can be found
in the LICENSE file.
The compiler and JIT is highly dependant on the Intel x86 Instruction Set Architecture (ISA) and Linux style calling convention.
- Install development packages for Ubuntu Linux Ubuntu 14.04 LTS:
sudo apt-get install gcc-multilib libc6-dev-i386
- Build and run
$ make
$ ./rubi [filename]