Cibyl, a lightweight curly-bracket language which compiles to Ruby and Crystal


#1

https://github.com/senselogic/CIBYL

// Recursive Fibonacci function

def fibonacci(
    n : Int32
    )
{
    if ( n <= 1 )
    {
        return 1;
    }
    else
    {
        return fibonacci( n - 1 ) + fibonacci( n - 2 );
    }
}

puts fibonacci( 5 );

Clearly NOT intended for the typical Ruby/Crystal lover, but rather to allow those who find a curly-bracket language syntax more pleasant to their eyes, to not disregard Ruby or Crystal just because of a silly syntactic preference…


#2

How fast is it? How much overhead does it apply to using Ruby or Crystal? Both in terms of productivity and performance?


#3

The compilation is instantaneous even for big files, and only the modified files are compiled when Cibyl is running in watch mode.

And the resulting code is 100% similar to handcrafted code, as Cibyl is implemented as an immediate transpiler, for productivity and performance reasons.

Even the line numbers are kept identical by default, to ease debugging.

Therefore there is absolutely no overhead of any sort.

The only downside is that you must properly align your blocks, as Cibyl uses their indentation to find their braces.


#4

Btw, Cibyl has been extended with a few more features, like being able to use other case conventions :

require "http/server";

server = HTTP::SERVER.New
    do | context |
    {
        context.Response.ContentType = "text/plain";
        context.Response.Print( "Hello world! The time is #{TIME.Now}" );
    }

address = server.BindTcp( 8080 );
Puts( "Listening on http://#{address}" );
server.Listen();