|
|
|
@ -21,9 +21,7 @@ V0.8
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
def Main : {
|
|
|
|
|
|
|
|
|
|
printf[ "hello world" ];
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
call Main;
|
|
|
|
|
```
|
|
|
|
@ -47,27 +45,18 @@ myfunction = { printf[ "hello world" ]; }; (statement list)
|
|
|
|
|
Variables are scoped to the struct that they are defined in. This is so everything is not global. An example of this would look:
|
|
|
|
|
```
|
|
|
|
|
def MyDog : {
|
|
|
|
|
|
|
|
|
|
age = -153000;
|
|
|
|
|
name = "i dont have a name";
|
|
|
|
|
|
|
|
|
|
printfMyName = {
|
|
|
|
|
|
|
|
|
|
printf[ name ];
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
def Main : {
|
|
|
|
|
|
|
|
|
|
someOtherAge = 2;
|
|
|
|
|
myRealDogsName = "cat"; // because variable naming is the hardest thing in computer science.
|
|
|
|
|
|
|
|
|
|
printfMyName = {
|
|
|
|
|
|
|
|
|
|
printf[ someOtherAge ];
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
call MyDog::printfMyName;
|
|
|
|
@ -75,8 +64,7 @@ def Main : {
|
|
|
|
|
When you do not use the scope resolution modifier then it will only check local functions.
|
|
|
|
|
The local function hashmap is stored in the head of your functions linked list.
|
|
|
|
|
/*
|
|
|
|
|
call printfMyName
|
|
|
|
|
|
|
|
|
|
call printfMyName;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
call Main;
|
|
|
|
@ -86,16 +74,12 @@ call Main;
|
|
|
|
|
Logic is first evaluated and if deemed valid then a list of statements will be executed.
|
|
|
|
|
```
|
|
|
|
|
if [ 10 > 9 ]: {
|
|
|
|
|
|
|
|
|
|
printf [ "10 is bigger than 9!" ];
|
|
|
|
|
newInt = 100;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if [ {int} newInt > 99 ]: {
|
|
|
|
|
|
|
|
|
|
printf [ "newInt is bigger than 99" ];
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@ -105,16 +89,12 @@ Functions can be declared inside of a struct and accessed by anyone who uses the
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
def NewStruct : {
|
|
|
|
|
|
|
|
|
|
someFunction = {
|
|
|
|
|
|
|
|
|
|
printf[ "hello world" ];
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
call NewStruct;
|
|
|
|
|
|
|
|
|
|
call NewStruct;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# Coming soon
|
|
|
|
|