diff options
| author | Alasdair Armstrong | 2017-07-17 18:46:00 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-07-17 18:46:00 +0100 |
| commit | 1090d8667193e3bc56bfc7a0d028566b36ad3b96 (patch) | |
| tree | bd7c9d69120df927f4ae3ddf6477345f0c009f4f /src/pretty_print.ml | |
| parent | 6c75d9386a9c179969c22baf1231f1bd7b9a60a3 (diff) | |
Added pattern guards to sail
Introduces a when keyword for case statements, as the Pat_when constructor for pexp's in the AST. This allows us to write things like:
typedef T = const union { int C1; int C2 }
function int test ((int) x, (T) y) =
switch y {
case (C1(z)) when z == 0 -> 0
case (C1(z)) when z != 0 -> x quot z
case (C2(z)) -> z
}
this should make translation from ASL's patterns much more straightforward
Diffstat (limited to 'src/pretty_print.ml')
0 files changed, 0 insertions, 0 deletions
