Branch-groups

The facility to branch is a need in any programming language, and ECMA-script has many useful solutions

Nested if-else blocks, switch blocks, etc are one method

let a = x+y==2
let b = x+y>2
let c = x+y<2

// Example #1
if(a){
    
} else if (a && b) {
    
} else if (b) {
    
} else /* c */ {

}

// Example #2
switch(input){
    case a:
        switch(input){
           case b: 
        }
    case b:
    case c:
}

However, tracing the grouping of many thousands can get unwieldly, and can become intractable

I have another solution, similar to ECMA switch statements, to better manage large blocks of indented code -- branch-groups

branch-group( expression[:label] [, expressionN[:label] ]* ){
    codeblock,
    .
    .
    .
    codeblockN,
}

Think of these as linear switch statements

Because most branching is performed following a comparison, branch-groups allow comparisons to be performed in parallel, allowing for a linear code retrace

And with the use of comma-delimiting, branch-groups allow for fall-through comparison, eliminating the need for nesting

branch-group[ x+y==2:000,x+y>2:001;x+y<2:002 ]{
    000: myFunctionCallOrCodeBlock000(), // x+y==2
    001: myFunctionCallOrCodeBlock001(), //(x+y==2) && (x+y>2)
    002: myFunctionCallOrCodeBlock002()  // x+y<2
}

See Related Work, Attributions

Yufeng Zhang - ACM/ASE Conference 2020
Yufeng Zhang : Multiplex Symbolic Execution - Exploring Multiple Paths by Solving Once

A similar result can be achieved with the switch (true) ... pattern:

switch (true) {
  case x + y > 2:
    myFunctionCallOrCodeBlock001();
  // falls through
  case x + y === 2:
    myFunctionCallOrCodeBlock000();
    break;
  case x + y < 2:
    myFunctionCallOrCodeBlock002();
    break;
}