Skip to content

Commit ce7a212

Browse files
committed
Replace (lin)exec by fire/interact and fix clash of variables in calling
1 parent 8fbcfce commit ce7a212

File tree

21 files changed

+114
-111
lines changed

21 files changed

+114
-111
lines changed

examples/automata.sg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(new-declaration (spec X Y) (:= X Y))
22
(new-declaration (:: Tested Test)
3-
(== @(exec @#Tested #Test) ok))
3+
(== @(interact @#Tested #Test) ok))
44

55
(spec binary {
66
[(-i []) ok]
@@ -40,7 +40,7 @@ automaton accepting words ending with 00
4040

4141
(:= kill (-a _ _))
4242

43-
(show (exec @(exec @#e #a1) #kill))
44-
(show (exec @(exec @#000 #a1) #kill))
45-
(show (exec @(exec @#010 #a1) #kill))
46-
(show (exec @(exec @#110 #a1) #kill))
43+
(show (interact @(interact @#e #a1) #kill))
44+
(show (interact @(interact @#000 #a1) #kill))
45+
(show (interact @(interact @#010 #a1) #kill))
46+
(show (interact @(interact @#110 #a1) #kill))

examples/binary4.sg

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
(new-declaration (spec X Y) (:= X Y))
2-
(spec u4 [(-b _ 1 _) (-b _ 2 _) (-b _ 3 _) (-b _ 4 _) ok])
3-
42
(new-declaration (:: Tested Test)
5-
(== @(exec (process #Test #Tested)) ok))
3+
(== @(interact (process #Test #Tested)) ok))
4+
5+
(spec u4 [(-b _ 1 _) (-b _ 2 _) (-b _ 3 _) (-b _ 4 _) ok])
66

77
(:= (make_bin Name X1 X2 X3 X4)
88
{ [(+b Name 1 X1)] [(+b Name 2 X2)] [(+b Name 3 X3)] [(+b Name 4 X4)] })
@@ -18,22 +18,18 @@
1818

1919
(:= (if A = X and B = Y then R = Z) [(-b A I X) (-b B I Y) (+b R I Z)])
2020

21-
'''
22-
'FIXME
23-
24-
(:= (and AA BB RR) {
25-
#(if AA = 0 and BB = XX then RR = 0)
26-
#(if AA = 1 and BB = XX then RR = XX) })
27-
(show #(and b1 b2 r1))
28-
(show (process #b1 #(and b1 b2 r1) #b2))
21+
(:= (and A B R) {
22+
#(if A = 0 and B = _ then R = 0)
23+
#(if A = 1 and B = X then R = X) })
24+
(show (process #b1 #(and b1 b2 r) #b2))
2925

3026
(:= (or A B R) {
31-
[(-b A I 0) (-b B I X) (+b R I X)]
32-
[(-b A I 1) (-b B I X) (+b R I 1)]})
27+
#(if A = 0 and B = X then R = X)
28+
#(if A = 1 and B = Y then R = 1) })
29+
(show (process #b1 #(or b1 b2 r) #b2))
3330

31+
'''
3432
(:= (xor A B R) {
35-
[(-b A I 1) (-b B I 0) (+b R I 1)]
36-
[(-b A I 0) (-b B I 1) (+b R I 1)]
37-
[(-b A I 0) (-b B I 0) (+b R I 0)]
38-
[(-b A I 1) (-b B I 1) (+b R I 0)]})
33+
#(if A = X and B = X then R = 0) })
34+
(show (process #b1 #(xor b1 b2 r) #b2))
3935
'''

examples/circuits.sg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FIXME
88
[(+not 1 0)] [(+not 0 1)]
99
[(+and 1 X X)][(+and 0 X 0)]})
1010

11-
<show exec (process
11+
<show interact (process
1212
'inputs
1313
[(-1 X) (+c0 X)]
1414
'layer 1
@@ -21,7 +21,7 @@ FIXME
2121
[(-c4 R) R]
2222
#semantics)>
2323

24-
<show exec (process
24+
<show interact (process
2525
'inputs
2626
{
2727
[(-0 X) (+c0 X)]

examples/lambda.sg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[(-id X) (-arg X)]
88
@[(+arg [r|X]) (out X)]})
99

10-
(show (exec #id #id_arg #linker))
10+
(show (interact #id #id_arg #linker))
1111

1212
' id x
1313
(:= var_x [(x (exp X Y)) (+arg (exp [l|X] Y))])
@@ -16,7 +16,7 @@
1616
[(-id X) (-arg X)]
1717
@[(+arg [r|X]) (out X)]})
1818

19-
(show (exec #id #var_x #linker))
19+
(show (interact #id #var_x #linker))
2020

2121
' lproj x
2222
(:= lproj {

examples/linear_lambda.sg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(new-declaration (spec X Y) (:= X Y))
22
(new-declaration (:: Tested Test)
3-
(== @(exec #Tested #Test) ok))
3+
(== @(interact #Tested #Test) ok))
44

55
' identity function (\x -> x)
66
(:= id [(+id [l|X]) (+id [r|X])])
@@ -12,7 +12,7 @@
1212
[(-id X) (-arg X)]
1313
@[(+arg [r|X]) (out X)]])
1414

15-
(show (exec #id #id_arg #linker))
15+
(show (interact #id #id_arg #linker))
1616

1717
' id x
1818
(:= x_arg [(x X) (+arg [l X])])
@@ -21,7 +21,7 @@
2121
[(-id X) (-arg X)]
2222
@[(+arg [r|X]) (out X)]])
2323

24-
(show (exec #id #x_arg #linker))
24+
(show (interact #id #x_arg #linker))
2525

2626
' linear types
2727
(spec (larrow a a) {

examples/mall.sg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
(:= cut [(-5 X) (-3 X)])
1111

12-
<show exec (process
12+
<show interact (process
1313
#with
1414
{ #plus #cut })>

examples/mll.sg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(new-declaration (spec X Y) (:= X Y))
22
(new-declaration (:: Tested Test)
3-
(== @(exec #Tested #Test) ok))
3+
(== @(interact #Tested #Test) ok))
44

55
' test of linear identity
66
(spec (larrow a a) {
@@ -43,17 +43,17 @@
4343
[+cuts [
4444
[(-7 X) (-8 X)]]]})
4545

46-
(:= vehicle (eval (exec #ps1 @[-vehicle])))
47-
(:= cuts (eval (exec #ps1 @[-cuts])))
46+
(:= vehicle (eval (interact #ps1 @[-vehicle])))
47+
(:= cuts (eval (interact #ps1 @[-cuts])))
4848

49-
(show (exec #vehicle #cuts))
49+
(show (interact #vehicle #cuts))
5050

5151
(spec (tens a b) {
5252
[(-1 [g|X]) (-2 [g|X]) (+3 [g|X])]
5353
@[(-3 [g|X]) ok]})
5454

5555
(new-declaration (::lin Tested Test)
56-
(== @(linexec #Tested #Test) ok))
56+
(== @(fire #Tested #Test) ok))
5757

5858
' does not typecheck
5959
' (::lin vehicle ((tens a a) linear))

examples/nat.sg

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(new-declaration (spec X Y) (:= X Y))
22
(new-declaration (:: Tested Test)
3-
(== @(exec @#Tested #Test) ok))
3+
(== @(interact @#Tested #Test) ok))
44

55
(spec nat {
66
[(-nat 0) ok]
@@ -21,6 +21,6 @@
2121
[(-nat 0) (res 1)]
2222
[(-nat (s _)) (res 0)]})
2323

24-
(show (exec @#add1 #2))
25-
(show (exec #is_empty @#0))
26-
(show (exec #is_empty @#1))
24+
(show (interact @#add1 #2))
25+
(show (interact #is_empty @#0))
26+
(show (interact #is_empty @#1))

examples/npda.sg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(new-declaration (spec X Y) (:= X Y))
22
(new-declaration (:: Tested Test)
3-
(== @(exec @#Tested #Test) ok))
3+
(== @(interact @#Tested #Test) ok))
44

55
(spec binary {
66
[(-i []) ok]
@@ -38,7 +38,7 @@
3838

3939
(:= kill (-a _ _ _))
4040

41-
(show (exec @(exec @#e #a1) #kill))
42-
(show (exec @(exec @#0000 #a1) #kill))
43-
(show (exec @(exec @#0110 #a1) #kill))
44-
(show (exec @(exec @#1110 #a1) #kill))
41+
(show (interact @(interact @#e #a1) #kill))
42+
(show (interact @(interact @#0000 #a1) #kill))
43+
(show (interact @(interact @#0110 #a1) #kill))
44+
(show (interact @(interact @#1110 #a1) #kill))

examples/prolog.sg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
' 2 + 2 = R
77
(:= query [(-add <s s 0> <s s 0> R) R])
88

9-
(show (exec #add @#query))
9+
(show (interact #add @#query))
1010

1111
(:= graph {
1212
[(+from 1) (+to 2)]
@@ -22,6 +22,6 @@
2222
@[(-from 1)]
2323
[(-to 4) ok]})
2424

25-
<show exec (process
25+
<show interact (process
2626
#query
2727
{ #graph #composition })>

0 commit comments

Comments
 (0)