AltoLang / Alto

Compiler in the works!
MIT License
3 stars 1 forks source link

Lower global statements into a main function #72

Closed FilipToth closed 3 years ago

FilipToth commented 3 years ago

Lowering global statements

function main() {
    // global statements
    print("Hello World!")
}

or in script mode:

function $eval() : any {
    return 2 + 3 // global statements
}

please note that comments are not supported yet...

Global return statements

Now, you can do this in the REPL (or in script mode)

return 2 + 3

Return statements are now supported in the global scope since that is getting lowered to an $eval function anyway.