olix3001 / PurrLang

Another attempt at programming language that compiles to scratch blocks.
3 stars 0 forks source link

[FEAT] Comptime expressions #7

Open olix3001 opened 3 months ago

olix3001 commented 3 months ago

Sometimes we do not want to use repeat block (for example when our block takes a field), that's why #[comptime] tag should be introduced.

For example writing

#[comptime]
repeat 3 {
    say("Hello, World!");
}

would be equal to

say("Hello, World!");
say("Hello, World!");
say("Hello, World!");

in the output.

Conditional expressions would also support this tag allowing for conditional compilation and more future possibilities. This, however, requires a bit of reworking in the variable system to keep track of compile time-known values.