eepykate / Rossa

High level multi-paradigm scripting language

Home Page:https://nallantli.github.io/Rossa/#/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rossa


Rossa libstd libfs libnet libgraphics libsdl libncurses License


Building & Installation

See Installation

Documentation

Scant, but progressing: https://nallantli.github.io/Rossa/#/


Basics

Hello World:

putln("Hello World!");

Factorial:

fact(x) => {
	if x > 1 then {
		return x * fact(x - 1);
	} else {
		return 1;
	}
}

putln(fact(5)); # 120

Fibonacci Sequence:

fib(ref size : Number) => {
	array := [0, 1] ++ alloc(size - 2);
	for i in 2 .. size do {
		array[i] = array[i - 1] + array[i - 2];
	}
	return array;
}

fib(20).map((e, i) => putln("{0}:\t{1}" & [i, e]));

FizzBuzz:

for i in 1 <> 100 do {
	if i % 3 == 0 && i % 5 == 0 then {
		putln("FizzBuzz");
	} elif i % 3 == 0 then {
		putln("Fizz");
	} elif i % 5 == 0 then {
		putln("Buzz");
	} else {
		putln(i);
	}
}

Basic File/Folder Output: (Note that the / operator is overloaded in class Path)

load "fs";

p := new Path();
p = p / "Example";
if !p.exists() then {
	p.mkdirs();
}

io := new FileIO(p / "example.txt");
io.write("Hello World");
io.close();

Threading:

f(ref x : Number, ref id : Number) => {
	for i in 0 .. x do {
		putln("Thread {0} says {1}" & [id, i]);
	}
}

t1 := new Thread(()[f] => f(10, 1));
t2 := new Thread(()[f] => f(10, 2));

t1.join();
t2.join();

Making languages

is very fun, but I wish

that it worked well too

About

High level multi-paradigm scripting language

https://nallantli.github.io/Rossa/#/

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 93.5%Language:C 5.4%Language:Makefile 1.1%