Giter Club home page Giter Club logo

rubi's Introduction

Rubi

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.

Syntax

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!!\n
puts "number = ", 65536 # => number = 65536\n
output "not new line" # => not new line

# declaration is not required
# support only integer
i = 10
i = i + 43
i = i % 5
i = i - 32
sum = i * (12 / 5)
12 / 5 # => 2

# loop and if
for i = 1, i < 100, i = i + 1
    if i % 15 == 0
        puts "fizzbuzz"
    elsif i % 5 == 0
        puts "buzz"
    elsif i % 3 == 0
        puts "fizz"
    else
        puts i
    end
end

# create function
# return is not support...
def sum(n)
    sm = 0
    for = 1, i <= n, i = i + 1
        sm = sm + i
    end
    sm
end
  • Implement Fibonacci in Rubi:
def fib(n)
    if n < 2
        1
    else
        fib(n - 1) + fib(n - 2)
    end
end

puts fib(39)

Licensing

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.

Portability

The compiler and JIT is highly dependant on the Intel x86 Instruction Set Architecture (ISA) and Linux style calling convention.

Quick Start

  • 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]

rubi's People

Contributors

jserv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.