Skip to content

Latest commit

 

History

History
598 lines (453 loc) · 7.02 KB

README.md

File metadata and controls

598 lines (453 loc) · 7.02 KB

MAFFIN

maffin.png

For looking at the structure beneath: @debug

For changing float numbers' precision: @precision x, where x is precision

If you need to print something: print( "something" )

To compile text while writing in terminal ~

To make executable file from imported one: chmod 755 maffin_mac or chmod 755 maffin_linux

WARNINGS

THIS MAY CAUSE A PROBLEM

func lol{
        if (get(Args, 0) == 0){ return 1; }
        return lol(get(Args, 0)-1)+lol(get(Args, 0)-1); //here
}

print(lol(2));
~

BECAUSE "lol(get(Args, 0)-1)" should be in brackets like this "(lol(get(Args, 0)-1))", so this is correct:

func lol{
        if (get(Args, 0) == 0){ return 1; }
        return lol(get(Args, 0)-1)+(lol(get(Args, 0)-1)); //here
}

print(lol(2));
~

it's because of the AST structure, all priorities depends only on brackets and order.

DATA STRUCTURES

:

STRUCTURES-------AND-THEIR-------TIME/MEMORY-NOTATIONS
structure set() get() push() pop() insert() erase() size
array O(1) O(1) - - - - O(n)
stack O(1) O(1) O(1) O(1) - - O(n)
skiplist O(logn) O(logn) - - O(logn) O(logn) O(nlogn)

:

EXAMPLES

V 1.0 ALPHA (skiplist implemented, a lot of bugs fixed, documentation added)

    skiplist lst;
    insert(lst, 5, 0);
    insert(lst, 6, 0);
    print(get(lst, 0));
    print(get(lst, 1));
    print(sizeof(lst));
    print(capacity(lst));
    erase(lst, 0);
    print(get(lst, 0));
    print(sizeof(lst));
    print(capacity(lst));
    ~

RETURNS

    6 
    5 
    3 
    6 
    5 
    2 
    6 

V 0.9 (stack implemented)

№1
    stack a;
    push(a, 5);
    push(a, 6);
    push(a, 10);
    print(get(a, 0));
    print(get(a, 1));
    print(get(a, 2));
    set(a, 2, 0);
    print(get(a, 0));
    pop(a);
    push(a, 100);
    print(get(a, 2));
    ~

RETURNS

    5
    6
    10
    2
    100 

V 0.85 (for renamed to while, bugs with while fixed)

№1
    int i = 0;
    while (i < 4){
        print(i);
        int u = 1;
        i = i+u;
    }
    ~

RETURNS

    0
    1
    2
    3

V 0.8 (for loop with one argument) // it was extremely easy because everything for loop I already had

№1
    int a = 0;
    for (a < 3){
        a = a+1;
        print(a);
    }
    ~

RETURNS

    1
    2
    3
    4

V 0.7 (recursion)

№1
    func loop{
        if (get(Args, 0) == 6) { return 0; }
        int i = get(Args, 0);
        print(i);
        print(sizeof(Args));
        print();
        loop(i+1);
        return 0;
    }
    loop(0);
    ~

RETURNS

    0
    1
    
    1
    1
    
    2
    1
    
    3
    1
    
    4
    1
    
    5
    1 
№2
    func loop{
        print(get(Args, 0));
        if (get(Args, 0) == get(Args, 1)) { return 0; }
        loop(get(Args, 0)+1, get(Args, 1));
        return 0;
    }
    loop(0, 6);
    ~

RETURNS

    0 
    1 
    2 
    3 
    4 
    5 
    6

V 0.65 (&&, || operations)

№1
    if ((3 > 2) || (3 < 2)){
        print(228);
    }
    if ((3 > 2) && (3 < 2)){
        print(822);
    }
    ~

RETURNS

    228

V 0.6 (if statements implemented)

№1
    if (3 > 2)
    {
        print(3);
    }
    ~

RETURNS

    3
№2
    if (3 < 2)
    {
        print(100);
    }
    if (3 > 2)
    {
        print(50);
    }
    ~

RETURNS

    50

V 0.5 (bool types and operations with them implemented)

№1
    print(3 < 2);
    print(3 <= 2);
    print(3 > 2);
    print(3 >= 2);
    print(3 == 2);
    print(2 < 2);
    print(2 <= 2);
    print(2 > 2);
    print(2 >= 2);
    print(2 == 2);
    ~

RETURNS

    0
    0
    1
    1
    0
    0
    1
    0
    1
    1 
№2
    int a = 35;
    int b = a+100;
    print(b < a);
    print(b > a);
    ~

RETURNS

    0
    1

V 0.45 (function arguments now in the array system)

It's little bit complicated thing, the point is that all the arguments of the function are represented as an Args array, so when you are passing any argument, to access them type get(Args, 'index' ), where 'index' is an int value. (V3 and V3.5 are permanently changed)

№1
    func lol{
        return get(Args, 0)+5;
    }
    print(lol(9));
    ~

RETURNS

    14
№2
    int glob = 10;

    func f
    {
        int u = get(Args, 0);
        int v = get(Args, 1);
        glob = glob + u + v;
        return 0;
    }

    print(f(5, 9));
    print(glob);
    ~

RETURNS

    0
    24
№3 FUN FACT

Here is no function with name lol, so it's just generating a container of variables.

    print(lol(5, 9));
    print(5, 9);
    print((5, 9));
    ~

RETURNS

    0 5 9
    5 9
    5 9

V 0.4 (arrays implemented)

№1
    array a[30];
    set(a, 100, 3);
    int lol = get(a, 3);
    print(lol);
    ~

RETURNS

    100

V 0.35 (recursion added)

    func rec{
        a = a + 1;
        rec(a);
        return a;
    }
    
    int a = 3;
    rec(a);
    ~

RETURNS

nothing because infinite recursion

V 0.3 (function implemented)

№1
    func lol {
        return 32+2;
    }
    
    print(lol());
    ~

RETURNS

    34
№2
    func lol {
        a = a + 3;
        return a;
    }
    
    int a = 2;
    lol(a);
    print(a);
    a = lol(a);
    print(a);
    ~

RETURNS

    2
    5
№3
    int kek = 100;
    
    func lol {
        kek = kek + 1;
        a = a + 1;
        return 5;
    }
    
    int a = 3;
    print(lol(a));
    print(kek);
    print(a);
    ~

RETURNS

    5
    101
    3

As you can see, a variable hasn't changed because it was not in global scope, to apply to a all alterations it should be coded a = lol(a);

№4
    int a = print(3);
    print(a);
    ~

RETURNS

    3
    3

V 0.2 (float implemented and @debug changed)

№1
    @debug
    @precision 30
    
    float a = 32.3423;
    print(a);
    ~

RETURNS

    a(3) 13(2) 32.3423(3) =(2) (1) 
    print(2) a(3) ((2) (1) 
    (0) 
    32.3423000000000016029844118748 

V 0.1

№1
    @debug

    int ok = 3;
    int op = 2;
    print(ok+op);
    
    ~

RETURNS

    ok 0 3 =  
    op 0 2 =  
    print ok op + (  
     
    5 
№2
    @debug

    int lol = 2+3-4;
    print(lol-3);
    ~

RETURNS

    lol 0 2 3 + 4 - =  
    print lol 3 - (  
 
    -2 

FUNNY THINGS

encoding.png