Decision Tables

One thing that is nice about the projectional editor in MPS is that you cannot just use textual notations, but also, for example, tables. We’ve built a little decision table. It uses a two-dimensional tabular projection to render the two dimensions that are and’ed together. Below is an example and a test case.

We’ve also added a gswitch expression, it’s a generified switch that can be used in expression context. It can use any boolean expression in the cases and is translated to a bunch of if/else statements wrapped in an inline function to put it into expression context. The decision tables are translated to nested gswitch expressions.

Leave a comment