diff options
Diffstat (limited to 'theories/nix/notations.v')
-rw-r--r-- | theories/nix/notations.v | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/theories/nix/notations.v b/theories/nix/notations.v new file mode 100644 index 0000000..e9995b5 --- /dev/null +++ b/theories/nix/notations.v | |||
@@ -0,0 +1,43 @@ | |||
1 | From mininix Require Export nix.operational. | ||
2 | |||
3 | (* Influenced by | ||
4 | https://gitlab.mpi-sws.org/iris/iris/-/blob/master/iris_heap_lang/notation.v | ||
5 | But always uses ":" instead of a scope. *) | ||
6 | |||
7 | Coercion EId' : string >-> expr. | ||
8 | Coercion NInt : Z >-> num. | ||
9 | Coercion NFloat : float >-> num. | ||
10 | Coercion LitNum : num >-> base_lit. | ||
11 | Coercion LitBool : bool >-> base_lit. | ||
12 | Coercion ELit : base_lit >-> expr. | ||
13 | Coercion EApp : expr >-> Funclass. | ||
14 | |||
15 | Notation "λattr: a , e" := (EAbsMatch a true e) | ||
16 | (at level 200, e, a at level 200, | ||
17 | format "'[' 'λattr:' a , '/ ' e ']'"). | ||
18 | Notation "λattr: a .., e" := (EAbsMatch a false e) | ||
19 | (at level 200, e, a at level 200, | ||
20 | format "'[' 'λattr:' a .., '/ ' e ']'"). | ||
21 | |||
22 | Notation "λ: x .. y , e" := (EAbs x .. (EAbs y e) ..) | ||
23 | (at level 200, x, y at level 1, e at level 200, | ||
24 | format "'[' 'λ:' x .. y , '/ ' e ']'"). | ||
25 | Notation "'let:' x := e1 'in' e2" := (ELet x e1 e2) | ||
26 | (at level 200, x at level 1, e1, e2 at level 200, | ||
27 | format "'[' 'let:' x := '[' e1 ']' 'in' '/' e2 ']'"). | ||
28 | Notation "'with:' a 'in' e" := (EWith a e) | ||
29 | (at level 200, a, e at level 200, | ||
30 | format "'[' 'with:' a 'in' '/' e ']'"). | ||
31 | |||
32 | Notation "'if:' e1 'then' e2 'else' e3" := (EIf e1 e2 e3) | ||
33 | (at level 200, e1, e2, e3 at level 200). | ||
34 | |||
35 | Notation "e1 .: e2" := (ESelect e1 e2) (at level 70, no associativity). | ||
36 | |||
37 | Notation "e1 +: e2" := (EBinOp AddOp e1 e2) (at level 50, left associativity). | ||
38 | Notation "e1 *: e2" := (EBinOp MulOp e1 e2). | ||
39 | Notation "e1 -: e2" := (EBinOp SubOp e1 e2) (at level 50, left associativity). | ||
40 | Notation "e1 /: e2" := (EBinOp DivOp e1 e2) (at level 40). | ||
41 | Notation "e1 =: e2" := (EBinOp EqOp e1 e2) (at level 70, no associativity). | ||
42 | Notation "e1 <: e2" := (EBinOp LtOp e1 e2) (at level 70, no associativity). | ||
43 | Notation "'ceil:' e" := (EBinOp (RoundOp Ceil) e LitNull) (at level 10). | ||