MarcellPerger1 / programming_lang_2

A programming language I'm making (yes, another one)
MIT License
1 stars 0 forks source link

De-sugar syntax step #40

Open MarcellPerger1 opened 2 weeks ago

MarcellPerger1 commented 2 weeks ago

Add a 'de-sugar' step which transforms code into the operations that can be easily translated into scratch (e.g. a *= b --> a = a * b).

In the current state of the language, this won't do much but later, this will do a large amount of the heavy lifting, like returning from functions, etc.

Requires #39 (see https://github.com/MarcellPerger1/programming_lang_2/issues/40#issuecomment-2471785961 below)

MarcellPerger1 commented 1 week ago

This should come after #39 (type checking) as some of these steps might require type/name information (e.g. stuff to do variable/list difference, any list operations, like .append need type info to compile down to the right intrinsic). Additionally, in the future, a lot more of the desugaring will rely on type info (think classes/structs).

A specific example is foo = bar; is different depending on whether foo is a variable (setVar:to:) or a list (more complicated, many different intrinsics required)