JakobTopholt / P4-Unitino

SW4 project at AAU creating our own compiler
4 stars 0 forks source link

Switch #61

Open Aavild opened 1 year ago

Aavild commented 1 year ago

Switch case should look like the following:

int a = 5;
switch(a) {
    case 2, 3 {
        a = 5;
    }
    case 4, 5 {
        a = 6;
    }
    default {
        a = 0;
    }
}

Multiply cases can share the same codeblock by seperation of cases with a comma. Cases never fall through and are always contained in the curly braces that follow the,m.