Add doSwitch DSL built-in, close #1478
Introduce resources