No description
Find a file
2022-01-17 08:58:28 +01:00
.github/workflows Create rust.yml 2022-01-01 13:55:56 +01:00
fuzz move fuzzing code to lib 2021-12-31 17:31:56 +01:00
src cool size asserts because perf lmao 2022-01-17 08:58:28 +01:00
tests fix stack things and underscore and more 2022-01-08 12:03:44 +01:00
.gitignore inital commit 2021-10-03 20:30:19 +02:00
ARCHITECTURE.md ARCHITECTURE.md 2022-01-01 14:57:49 +01:00
Cargo.lock more function things 2022-01-16 19:58:52 +01:00
Cargo.toml more things 2022-01-17 08:39:19 +01:00
clippy.toml hello world! 2021-12-31 16:44:21 +01:00
grammar.txt add assignments 2021-11-03 21:04:11 +01:00
LICENSE Create LICENSE 2021-10-25 16:56:37 +02:00
README.md pattern matching syntax idea 2022-01-01 14:27:09 +01:00
std.md start bird 2021-11-03 21:17:32 +01:00
test.dil cool size asserts because perf lmao 2022-01-17 08:58:28 +01:00

dilaria is a small embeddable scripting language

It's inspired by Javascript, Lox, Lua, Python, Rust and more

Reference

Overview

Declaring variables using let

let hello = 4;

Semicolons are needed :)

let test = 5;
let another = 4;

The language has strings, numbers, arrays, objects and null and booleans

let string = "hallo";
let number = 4; 
let array = [];
let object = {};
let _null = null;
let bool = true;

You access properties on objects using .

let obj = {};
obj.hi = "hi!";

There is the print statement to print a value, but this will be removed

let name = "nils";
print name;

Functions are first class

let obj = {};
obj.hello = helloFn;
obj.hello();

Functions are declared using fn

fn greet(name) {
    return "hello, " + name;
}

Functions are closures

Comments using #

# hi!

Multiline comments using ## until ##

##
hi
comment
##

There are many native functions, that can easily be customized and added/removed by the host

# rocket game
turnRocketLeft(29);
turnRocketRight(32);

# chat bot
message.respond("hi");

# dangerous http requests
fn callback(html) {
    print(html);
}
fetch("https://github.com/Nilstrieb", callback);

Basic arithmetic and boolean logic is available

let a = 5;
let b = 5;
print(a + b / b * b - a % b);
print(true and false or false or true and false);

Loops and conditionals

let x = true;
if x {
    print("true!");
} else {
    print("false :(");
}

loop {
    while 1 > 5 {
        print("yeet");
        break;
    }
    # no for loops for now, but will be added (probably like python)
}

Pattern matching!

# design is still wip

let obj = {};
obj.x = 5;
obj.y = "hey";

match obj {
    { no } => print "our thing didn't match here",
    { x, y } => print "we got it! " + x,
    "test" => print "string 'test'",
    other => print "something else: " + other,
}

dilaria is dynamically and strongly typed

Detail

Reserved Keywords

Statements

fn let if else loop while for break (print temporary)

Values

true false null

Operators

not and or

Operators

== >= > <= < != + - * / %