Skip to content

Commit 95edb42

Browse files
committed
Remove kill and clean
1 parent ace5db5 commit 95edb42

File tree

11 files changed

+65
-105
lines changed

11 files changed

+65
-105
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ automaton accepting words ending with 00
7575
#(if read 1 on q0 then q0)
7676
#(if read 0 on q1 then q2)})
7777
78-
<show kill exec { @#e #a1 }>
79-
<show kill exec { @#000 #a1 }>
80-
<show kill exec { @#010 #a1 }>
81-
<show kill exec { @#110 #a1 }>
78+
(:= kill (-a _ _))
79+
80+
<show exec { @(exec { @#e #a1 }) #kill }>
81+
<show exec { @(exec { @#000 #a1 }) #kill }>
82+
<show exec { @(exec { @#010 #a1 }) #kill }>
83+
<show exec { @(exec { @#110 #a1 }) #kill }>
8284
```
8385

8486
More examples can be found in `examples/`.

examples/automata.sg

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
(:= 110 (+i [1 1 0]))
2323
(:: 110 binary)
2424

25-
'''
26-
automaton accepting words ending with 00
27-
'''
2825
(:= (initial Q) [(-i W) (+a W Q)])
2926
(:= (accept Q) [(-a [] Q) accept])
3027
(:= (if read C1 on Q1 then Q2) [(-a [C1|W] Q1) (+a W Q2)])
3128

29+
'''
30+
automaton accepting words ending with 00
31+
'''
3232
(:= a1 {
3333
#(initial q0)
3434
#(accept q2)
@@ -37,7 +37,9 @@ automaton accepting words ending with 00
3737
#(if read 1 on q0 then q0)
3838
#(if read 0 on q1 then q2)})
3939

40-
<show kill exec { @#e #a1 }>
41-
<show kill exec { @#000 #a1 }>
42-
<show kill exec { @#010 #a1 }>
43-
<show kill exec { @#110 #a1 }>
40+
(:= kill (-a _ _))
41+
42+
<show exec { @(exec { @#e #a1 }) #kill }>
43+
<show exec { @(exec { @#000 #a1 }) #kill }>
44+
<show exec { @(exec { @#010 #a1 }) #kill }>
45+
<show exec { @(exec { @#110 #a1 }) #kill }>

examples/binary4.sg

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,38 @@
1-
'''
2-
(spec u4 [(-b 1 _) (-b 2 _) (-b 3 _) (-b 4 _) ok])
1+
(spec u4 [(-b _ 1 _) (-b _ 2 _) (-b _ 3 _) (-b _ 4 _) ok])
32

4-
(new-declaration (:: tested test)
5-
(:= test @(exec (process #test #test{b=>+b})))
6-
(== test ok))
3+
(new-declaration (:: Tested Test)
4+
(== @(exec (process #Test #Tested)) ok))
75

8-
(:= b1 [ [(b 1 1)] [(b 2 0)] [(b 3 0)] [(b 4 1)]])
9-
(:: b1 u4)
6+
(:= (make_bin Name X1 X2 X3 X4)
7+
{ [(+b Name 1 X1)] [(+b Name 2 X2)] [(+b Name 3 X3)] [(+b Name 4 X4)] })
108

11-
(:= b2 [ [(b 1 0)] [(b 2 0)] [(b 3 1)] [(b 4 1)]])
9+
(:= b1 #(make_bin b1 0 0 0 1))
1210
(:: b1 u4)
1311

14-
(:= and [
15-
[(-b1 arg 0) (-b2 arg X) (b arg 0)]
16-
[(-b1 arg 1) (-b2 arg X) (b arg X)]])
17-
18-
(:= or [
19-
[(-b1 arg 0) (-b2 arg X) (b arg X)]
20-
[(-b1 arg 1) (-b2 arg X) (b arg 1)]])
21-
22-
(:= xor [
23-
[(-b1 arg 1) (-b2 arg 0) (b arg 1)]
24-
[(-b1 arg 0) (-b2 arg 1) (b arg 1)]
25-
[(-b1 arg 0) (-b2 arg 0) (b arg 0)]
26-
[(-b1 arg 1) (-b2 arg 1) (b arg 0)]])
27-
28-
'logical AND
29-
<show exec (process
30-
#b1{b=>+b1}
31-
#and{arg=>1} #and{arg=>2} #and{arg=>3} #and{arg=>4}
32-
#b2{b=>+b2}
33-
kill)>
34-
35-
'logical OR
36-
<show exec (process
37-
#b1{b=>+b1}
38-
#or{arg=>1} #or{arg=>2} #or{arg=>3} #or{arg=>4}
39-
#b2{b=>+b2}
40-
kill)>
41-
42-
'logical XOR
43-
<show exec (process
44-
#b1{b=>+b1}
45-
#xor{arg=>1} #xor{arg=>2} #xor{arg=>3} #xor{arg=>4}
46-
#b2{b=>+b2}
47-
kill)>
48-
'''
12+
(:= b2 #(make_bin b2 0 0 1 1))
13+
(:: b2 u4)
14+
15+
(show #b1)
16+
(show #b2)
17+
18+
(:= (if A = X and B = Y then R = Z) [(-b A I X) (-b B I Y) (+b R I Z)])
19+
20+
'''
21+
'FIXME
22+
23+
(:= (and AA BB RR) {
24+
#(if AA = 0 and BB = XX then RR = 0)
25+
#(if AA = 1 and BB = XX then RR = XX) })
26+
(show #(and b1 b2 r1))
27+
(show (process #b1 #(and b1 b2 r1) #b2))
28+
29+
(:= (or A B R) {
30+
[(-b A I 0) (-b B I X) (+b R I X)]
31+
[(-b A I 1) (-b B I X) (+b R I 1)]})
32+
33+
(:= (xor A B R) {
34+
[(-b A I 1) (-b B I 0) (+b R I 1)]
35+
[(-b A I 0) (-b B I 1) (+b R I 1)]
36+
[(-b A I 0) (-b B I 0) (+b R I 0)]
37+
[(-b A I 1) (-b B I 1) (+b R I 0)]})
38+
'''

examples/circuits.sg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,3 @@ FIXME
3636
[(-c4 R) R]
3737
'apply semantics
3838
#semantics)>
39-
'&kill

examples/npda.sg

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
#(if read 0 with 0 on q1 then q1)
3636
#(if read 1 with 1 on q1 then q1)})
3737

38-
<show kill exec { @#e #a1 }>
39-
<show kill exec { @#0000 #a1 }>
40-
<show kill exec { @#0110 #a1 }>
41-
<show kill exec { @#1110 #a1 }>
38+
(:= kill (-a _ _ _))
39+
40+
<show exec { @(exec { @#e #a1 }) #kill }>
41+
<show exec { @(exec { @#0000 #a1 }) #kill }>
42+
<show exec { @(exec { @#0110 #a1 }) #kill }>
43+
<show exec { @(exec { @#1110 #a1 }) #kill }>

examples/turing.sg

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
[(-m q3 L e R) (+m qr L e R)]
3030
[(-m qr L C R) reject]})
3131

32-
<show kill exec { @(+i [a e e]) #mt}>
33-
<show kill exec { @(+i [b e e]) #mt}>
34-
<show kill exec { @(+i [a b b e e]) #mt}>
32+
<show exec { @(+i [a e]) #mt}>
33+
<show exec { @(+i [b e]) #mt}>
34+
<show exec { @(+i [a b b e]) #mt}>
3535

36-
<show kill exec { @(+i [e e]) #mt}>
37-
<show kill exec { @(+i [a b e e]) #mt}>
38-
<show kill exec { @(+i [a a b b e e]) #mt}>
39-
<show kill exec { @(+i [a b b a e e]) #mt}>
40-
<show kill exec { @(+i [a b a b e e]) #mt}>
36+
<show exec { @(+i [e]) #mt}>
37+
<show exec { @(+i [a b e]) #mt}>
38+
<show exec { @(+i [a a b b e]) #mt}>
39+
<show exec { @(+i [a b b a e]) #mt}>
40+
<show exec { @(+i [a b a b e]) #mt}>

nvim/syntax/stellogen.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
syn clear
22

3-
syn keyword sgKeyword new declaration kill clean eval slice show use exec spec linexec process
3+
syn keyword sgKeyword new declaration eval slice show use exec spec linexec process
44
syn match sgComment "\s*'[^'].*$"
55
syn match sgId "#\%(\l\|\d\)\w*"
66
syn region sgComment start="'''" end="'''" contains=NONE

src/expr.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,6 @@ let rec sgen_expr_of_expr (e : expr) : sgen_expr =
182182
Group (List.map ~f:sgen_expr_of_expr gs)
183183
(* process *)
184184
| List (Symbol "process" :: gs) -> Process (List.map ~f:sgen_expr_of_expr gs)
185-
(* kill *)
186-
| List [ Symbol "kill"; g ] -> Kill (sgen_expr_of_expr g)
187-
(* clean *)
188-
| List [ Symbol "clean"; g ] -> Clean (sgen_expr_of_expr g)
189185
(* exec *)
190186
| List [ Symbol "exec"; g ] -> Exec (false, sgen_expr_of_expr g)
191187
(* linear exec *)

src/lsc_eval.ml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ let ( let* ) x f = Result.bind x ~f
77

88
type configuration = constellation * constellation
99

10-
let unpolarized_star s =
11-
let open Raw in
12-
List.for_all ~f:(Fn.compose not is_polarised) s.content
13-
14-
let kill = List.filter ~f:unpolarized_star
15-
16-
let clean = List.filter ~f:(fun s -> List.is_empty s.content)
1710

1811
let fmap_ban ~f = function
1912
| Ineq (b1, b2) -> Ineq (f b1, f b2)
@@ -166,4 +159,4 @@ let exec ?(linear = false) mcs : constellation =
166159
| Some res, new_actions -> loop (new_actions, res)
167160
in
168161
let cfg = extract_intspace mcs in
169-
loop cfg
162+
loop cfg |> List.filter ~f:(fun s -> not @@ List.is_empty s.content)

src/sgen_ast.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ type sgen_expr =
1313
| Exec of bool * sgen_expr
1414
| Group of sgen_expr list
1515
| Focus of sgen_expr
16-
| Clean of sgen_expr
17-
| Kill of sgen_expr
1816
| Process of sgen_expr list
1917
| Eval of sgen_expr
2018

0 commit comments

Comments
 (0)