juicebox 0.1.0

A simple, yet advanced programming language
. examples/learnjb.jb
. An "Learn X in Y minutes"-like tutorial in juicebox
.
. Copyright (C) 2024 Max Walters
.
. To the extent possible under law, the author(s) have dedicated all copyright
. and related and neighboring rights to this software to the public domain
. worldwide. This software is distributed without any warranty.
.
. You should have received a copy of the CC0 Public Domain Dedication along
. with this software. If not, see
. <http://creativecommons.org/publicdomain/zero/1.0/>.

// single line comment

/* multi-line
   comment
*/

: documentation comment

. copyright comment

using std; // import standard library, required to do basic tasks

: types
_types {
    _str:string = "string";
    _num:number = 123;
    _bool:boolean = true;

    // you can create arrays by using `type-name + []`
    _str_array:string[] = [ "a", "b", "c" ];
    _num_array:number[] = [ 1, 2, 3 ];
    _bool:boolean[] = [ true, false, null ];

    // if the inner types of an array are assorted, then you can just simply do `[]`
    _array:[] = [ "a", 2, false ];

    // you may also not use a type to infer a type
    _maybe = "This may or may not be a string";
}

: basic input/output
_io {
    *("Everything is OK!"); // normally prints to console
    !("You'd might want to check this out..."); // prints as an error to console
}

: control (if-then-else, while, for (each))
_control {
    // you can use is, not, greater, lesser
    if "a" is "a" {
        *("a is a!");
    }
}

main {
    0; // exits with code 0
}