Raylang

From Esolang
Jump to navigation Jump to search

Raylang is a clone of brainfuck, dedicated to the worship of the Raylib community. It was created by LonelyFloat in May 2022.

Context

Raylib is an open-source, cross-platform library explicitly intended for use in game development. It is written in C and is currently in version 4.0.0.

Overview

Raylang functions exactly as brainfuck does, only each command is replaced with keywords relevant to Raylib.

Command Description Brainfuck equivalent
ray Increment the cell pointer >
lib Decrement the cell pointer <
raylib Increment cell at the pointer +
libray Decrement cell at the pointer -
libraylib Input and store a character at the pointer ,
raylibray Output cell ASCII character at the pointer .
rayray Jump past the matching liblib if the cell at the pointer is 0 [
liblib Jump to the matching rayray if the cell at the pointer is not 0 ]

Example Programs

Hello, World!

This program prints Hello World! to the console.

raylib raylib raylib raylib raylib raylib raylib raylib
rayray
    ray raylib raylib raylib raylib
    rayray
        ray raylib raylib
        ray raylib raylib raylib
        ray raylib raylib raylib
        ray raylib
        lib lib lib lib libray
    liblib
    ray raylib
    ray raylib
    ray libray
    ray ray raylib
    rayray lib liblib
    lib libray
liblib
ray ray raylibray
ray libray libray libray raylibray
raylib raylib raylib raylib raylib raylib raylib raylibray raylibray
raylib raylib raylib raylibray
ray ray raylibray
lib libray raylibray
lib raylibray
raylib raylib raylib raylibray
libray libray libray libray libray libray raylibray
libray libray libray libray libray libray libray libray raylibray
ray ray raylib raylibray
ray raylib raylib raylibray

Trivial brainfuck substitution interpreter

#!/usr/bin/ruby
eval 'm=Hash.new(p=0);'+ARGF.read.downcase.gsub(/[!-~]+|./,
     'ray' => 'p+=1;',
     'lib' => 'p-=1;',
     'raylib' => 'm[p]+=1;',
     'libray' => 'm[p]-=1;',
     'raylibray' => 'putc m[p];',
     'libraylib' => 'm[p]=STDIN.getbyte if !STDIN.eof;',
     'rayray' => '(',
     'liblib' => ')while((m[p]&=255)!=0);')

External Resources

Original Haskell implementation

Raylib repository