Ratstail91 / Toy

The Toy Programming Language.
https://toylang.com/
zlib License
231 stars 11 forks source link

Variable Implementation #144

Closed Ratstail91 closed 2 weeks ago

Ratstail91 commented 3 weeks ago

Variables need:

Type syntax:

var name: type = value;

Types will be read here:

https://github.com/Ratstail91/Toy/blob/5b17c5e1e9f0644a51f266ad83fec533469234df/source/toy_parser.c#L542-L543

Additional types will be added here.

https://github.com/Ratstail91/Toy/blob/5b17c5e1e9f0644a51f266ad83fec533469234df/source/toy_value.h#L8-L20

Scope Syntax:

var name = 42;
{
    var name = 8891; //shadows the outer variable
}

Still no clue how to tackle constness.

Ratstail91 commented 3 weeks ago

https://github.com/Ratstail91/Toy/blob/d22b18ed17786e7e682a60994e7eb8223091b6c5/source/toy_routine.c#L263

Should replace this byte with the constness flag.