sunjay / brain

A high level programming language that compiles into the brainfuck esoteric programming language
MIT License
167 stars 12 forks source link

Limited const declarations #62

Open sunjay opened 7 years ago

sunjay commented 7 years ago

We already have the ScopeItem variants to support this for basic constant values (like booleans), byte literals and numbers. We could add a feature similar to what Rust has for const declarations. These are values with no memory address. They get inlined during compilation. They must have a declared type.

const foo: u8 = 17;
const bar: [u8; _] = b"bar spam";
const DEBUG: bool = false;

These const declarations would support very limited code on the right-hand side (literal values only for now).