Skip to content

Commit c5a8cab

Browse files
authored
[spectec] Fix typos in IL semantics (#2091)
1 parent f2fce28 commit c5a8cab

2 files changed

Lines changed: 8 additions & 22 deletions

File tree

spectec/doc/semantics/il/4-subst.spectec

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def $subst_typ(s, ITER t it) = ITER $subst_typ(s, t) $subst_iter(s, it)
5757

5858
def $subst_deftyp(subst, deftyp) : deftyp
5959
def $subst_deftyp(s, ALIAS t) = ALIAS $subst_typ(s, t)
60-
def $subst_deftyp(s, STRUCT (a `: t `- `{q*} pr*)*) = STRUCT (a `: $subst_typ(s, t) `- `{$subst_quant(s, b)*} $subst_prem(s, pr)*)* ;; TODO: avoid capture
61-
def $subst_deftyp(s, VARIANT (m `: t `- `{q*} pr*)*) = VARIANT (m `: $subst_typ(s, t) `- `{$subst_quant(s, b)*} $subst_prem(s, pr)*)* ;; TODO: avoid capture
60+
def $subst_deftyp(s, STRUCT (a `: t `- `{q*} pr*)*) = STRUCT (a `: $subst_typ(s, t) `- `{$subst_quant(s, q)*} $subst_prem(s, pr)*)* ;; TODO: avoid capture
61+
def $subst_deftyp(s, VARIANT (m `: t `- `{q*} pr*)*) = VARIANT (m `: $subst_typ(s, t) `- `{$subst_quant(s, q)*} $subst_prem(s, pr)*)* ;; TODO: avoid capture
6262

6363

6464
;; Iterators
@@ -149,20 +149,6 @@ def $subst_prem(s, LET e_1 `= e_2) = LET $subst_exp(s, e_1) `= $subst_exp(s, e_2
149149
def $subst_prem(s, ITER pr it (x `<- e)*) = ITER $subst_prem(s, pr) $subst_iter(s, it) (x `<- $subst_exp(s, e))* ;; TODO: avoid capture
150150

151151

152-
;; Constructing substitutions for parameters
153-
154-
def $arg_for_param(arg, param) : subst
155-
def $arg_for_param(EXP e, EXP x `: t) = {EXP (x, e)}
156-
def $arg_for_param(TYP t, TYP x) = {TYP (x, t)}
157-
def $arg_for_param(FUN y, FUN x `: p* `-> t) = {FUN (x, y)}
158-
def $arg_for_param(GRAM g, GRAM x `: p* `-> t) = {GRAM (x, g)}
159-
160-
def $args_for_params(arg*, param*) : subst
161-
def $args_for_params(eps, eps) = {}
162-
def $args_for_params(a_1 a*, p_1 p*) = s ++ $args_for_params(a*, $subst_param(s, p)*)
163-
-- if s = $arg_for_param(a_1, p_1)
164-
165-
166152
;; Well-formedness
167153

168154
def $paramarg(param) : arg

spectec/doc/semantics/il/5-reduction.spectec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rule Expand_typ/alias:
1717

1818
rule Expand_typ/step:
1919
S |- VAR x a* => $subst_deftyp(s, dt)
20-
-- if (x, p* `-> OK `= inst*) <- E.TYP
20+
-- if (x, p* `-> OK `= inst*) <- S.TYP
2121
-- if (INST `{q*} a* `= dt) <- inst*
2222
-- Match_args: S |- a* `/ `{q*} a'* => s
2323

@@ -123,11 +123,11 @@ rule Step_exp/CMP-EQ-true:
123123

124124
rule Step_exp/CMP-EQ-false:
125125
S |- CMP EQ val_1 val_2 ~> BOOL false
126-
-- if val_1 =/= val_2
126+
-- if val_1 = val_2
127127

128128
rule Step_exp/CMP-NE-false:
129129
S |- CMP NE e_1 e_2 ~> BOOL false
130-
-- if e_1 = e_2
130+
-- if e_1 =/= e_2
131131

132132
rule Step_exp/CMP-NE-true:
133133
S |- CMP NE val_1 val_2 ~> BOOL true
@@ -338,7 +338,7 @@ rule Step_exp/ITER-STAR:
338338
-- if |e'**[0]| = n
339339

340340
rule Step_exp/ITER-SUP-eps:
341-
S |- ITER e (SUP eps e_n) (x `<- LIST e'*)* ~> ITER e (SUP y n) (x `<- LIST e'*)*
341+
S |- ITER e (SUP eps e_n) (x `<- LIST e'*)* ~> ITER e (SUP y e_n) (x `<- LIST e'*)*
342342
;; TODO: y fresh
343343

344344
rule Step_exp/ITER-SUP:
@@ -352,7 +352,7 @@ rule Step_exp/CALL-ctx:
352352

353353
rule Step_exp/CALL-apply:
354354
S |- CALL x a* ~> $subst_exp(s, e)
355-
-- if (x, p* `-> t `= clause*) <- E.FUN
355+
-- if (x, p* `-> t `= clause*) <- S.FUN
356356
-- if (CLAUSE `{q*} a'* `= e `- pr*) <- clause*
357357
-- Match_args: S |- a* `/ `{q*} a'* => s
358358
-- Reduce_prems: S |- $subst_prem(s, pr)* ~>* eps
@@ -519,7 +519,7 @@ rule Step_prems/ITER-STAR:
519519
-- if |e**[0]| = n
520520

521521
rule Step_prems/ITER-SUP-eps:
522-
S |- ITER pr (SUP eps e_n) (x `<- LIST e*)* ~> ITER pr (SUP y n) (x `<- LIST e*)*
522+
S |- ITER pr (SUP eps e_n) (x `<- LIST e*)* ~> ITER pr (SUP y e_n) (x `<- LIST e*)*
523523
;; TODO: y fresh
524524

525525
rule Step_prems/ITER-SUP:

0 commit comments

Comments
 (0)