Skip to content

Commit cbc57ba

Browse files
committed
Simpler DSL for WS
1 parent a99896e commit cbc57ba

File tree

77 files changed

+973
-1413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+973
-1413
lines changed
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
1-
[ Push
2-
( Literal 3 )
1+
[ Push 3
32
, Mark "LOOP"
43
, Dup
54
, OutputNum
6-
, PushS
7-
( Literal " bottles of beer on the wall, " )
5+
, PushS " bottles of beer on the wall, "
86
, Call "prints"
97
, Dup
108
, OutputNum
11-
, PushS
12-
( Literal " bottles of beer" )
9+
, PushS " bottles of beer"
1310
, Call "printsln"
14-
, PushS
15-
( Literal "Take one down, pass it around" )
11+
, PushS "Take one down, pass it around"
1612
, Call "printsln"
17-
, Push
18-
( Literal 1 )
13+
, Push 1
1914
, Sub Nothing
2015
, Dup
2116
, OutputNum
22-
, PushS
23-
( Literal " bottles of beer on the wall" )
17+
, PushS " bottles of beer on the wall"
2418
, Call "printsln"
25-
, PushS
26-
( Literal "" )
19+
, PushS ""
2720
, Call "printsln"
2821
, Dup
2922
, BranchNZ "LOOP"
@@ -38,8 +31,7 @@
3831
, Return
3932
, Mark "printsln"
4033
, Call "prints"
41-
, Push
42-
( Literal 10 )
34+
, Push 10
4335
, OutputChar
4436
, Return
4537
]

.output/actual/wsa/il/linkAppFile/from-eas/hello.il

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
1-
[ Push
2-
( Literal 32 )
3-
, Push
4-
( Literal 44 )
5-
, Push
6-
( Literal 111 )
7-
, Push
8-
( Literal 108 )
9-
, Push
10-
( Literal 108 )
11-
, Push
12-
( Literal 101 )
13-
, Push
14-
( Literal 72 )
15-
, OutputChar
16-
, OutputChar
17-
, OutputChar
18-
, OutputChar
19-
, OutputChar
20-
, OutputChar
21-
, OutputChar
22-
, Push
23-
( Literal 10 )
24-
, Push
25-
( Literal 33 )
26-
, Push
27-
( Literal 100 )
28-
, Push
29-
( Literal 108 )
30-
, Push
31-
( Literal 114 )
32-
, Push
33-
( Literal 111 )
34-
, Push
35-
( Literal 119 )
1+
[ Push 32
2+
, Push 44
3+
, Push 111
4+
, Push 108
5+
, Push 108
6+
, Push 101
7+
, Push 72
8+
, OutputChar
9+
, OutputChar
10+
, OutputChar
11+
, OutputChar
12+
, OutputChar
13+
, OutputChar
14+
, OutputChar
15+
, Push 10
16+
, Push 33
17+
, Push 100
18+
, Push 108
19+
, Push 114
20+
, Push 111
21+
, Push 119
3622
, OutputChar
3723
, OutputChar
3824
, OutputChar
Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
1-
[ Push
2-
( Literal 0 )
3-
, Push
4-
( Literal 10 )
5-
, Push
6-
( Literal 33 )
7-
, Push
8-
( Literal 100 )
9-
, Push
10-
( Literal 108 )
11-
, Push
12-
( Literal 114 )
13-
, Push
14-
( Literal 111 )
15-
, Push
16-
( Literal 119 )
17-
, Push
18-
( Literal 32 )
19-
, Push
20-
( Literal 44 )
21-
, Push
22-
( Literal 111 )
23-
, Push
24-
( Literal 108 )
25-
, Push
26-
( Literal 108 )
27-
, Push
28-
( Literal 101 )
29-
, Push
30-
( Literal 72 )
1+
[ Push 0
2+
, Push 10
3+
, Push 33
4+
, Push 100
5+
, Push 108
6+
, Push 114
7+
, Push 111
8+
, Push 119
9+
, Push 32
10+
, Push 44
11+
, Push 111
12+
, Push 108
13+
, Push 108
14+
, Push 101
15+
, Push 72
3116
, Call "prints"
3217
, End
3318
, Mark "prints"
@@ -40,8 +25,7 @@
4025
, Return
4126
, Mark "printsln"
4227
, Call "prints"
43-
, Push
44-
( Literal 10 )
28+
, Push 10
4529
, OutputChar
4630
, Return
4731
]

.output/actual/wsa/il/linkAppFile/from-eas/hello4.il

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[ PushS
2-
( Literal "Hello, world!" )
1+
[ PushS "Hello, world!"
32
, Call "printsln"
43
, End
54
, Mark "prints"
@@ -12,8 +11,7 @@
1211
, Return
1312
, Mark "printsln"
1413
, Call "prints"
15-
, Push
16-
( Literal 10 )
14+
, Push 10
1715
, OutputChar
1816
, Return
1917
]

.output/actual/wsa/il/linkAppFile/from-eas/pip.il

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[ Mark "LOOP"
22
, Dup
3-
, Push
4-
( Literal 0 )
5-
, Push
6-
( Literal 1 )
3+
, Push 0
4+
, Push 1
75
, Sub Nothing
86
, Sub Nothing
97
, BranchNZ "WRITE"
Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,77 @@
11
[ Mark "st"
2-
, PushS
3-
( Literal "prim numbers [2-100]" )
2+
, PushS "prim numbers [2-100]"
43
, Call "printsln"
5-
, Push
6-
( Literal 0 )
4+
, Push 0
75
, Mark "f_start_1"
86
, Test 100
97
, BranchZ "f_finished_1"
108
, Dup
119
, Add
12-
( Just
13-
( Literal 100 )
14-
)
15-
, Push
16-
( Literal 1 )
10+
( Just 100 )
11+
, Push 1
1712
, Store Nothing
1813
, Add
19-
( Just
20-
( Literal 1 )
21-
)
14+
( Just 1 )
2215
, Branch "f_start_1"
2316
, Mark "f_finished_1"
2417
, Pop
25-
, Push
26-
( Literal 2 )
18+
, Push 2
2719
, Mark "f_start_2"
2820
, Test 11
2921
, BranchZ "f_finished_2"
30-
, Push
31-
( Literal 2 )
22+
, Push 2
3223
, Mark "f_start_3"
3324
, Test 100
3425
, BranchZ "f_finished_3"
3526
, Dup
36-
, Push
37-
( Literal 1 )
27+
, Push 1
3828
, Swap
3929
, Store Nothing
4030
, Swap
4131
, Dup
42-
, Push
43-
( Literal 2 )
32+
, Push 2
4433
, Swap
4534
, Store Nothing
4635
, Swap
4736
, Load
48-
( Just
49-
( Literal 1 )
50-
)
37+
( Just 1 )
5138
, Load
52-
( Just
53-
( Literal 2 )
54-
)
39+
( Just 2 )
5540
, Mul Nothing
5641
, Add
57-
( Just
58-
( Literal 100 )
59-
)
60-
, Push
61-
( Literal 0 )
42+
( Just 100 )
43+
, Push 0
6244
, Store Nothing
6345
, Add
64-
( Just
65-
( Literal 1 )
66-
)
46+
( Just 1 )
6747
, Branch "f_start_3"
6848
, Mark "f_finished_3"
6949
, Pop
7050
, Add
71-
( Just
72-
( Literal 1 )
73-
)
51+
( Just 1 )
7452
, Branch "f_start_2"
7553
, Mark "f_finished_2"
7654
, Pop
77-
, Push
78-
( Literal 2 )
55+
, Push 2
7956
, Mark "f_start_4"
8057
, Test 100
8158
, BranchZ "f_finished_4"
8259
, Dup
8360
, Add
84-
( Just
85-
( Literal 100 )
86-
)
61+
( Just 100 )
8762
, Load Nothing
8863
, BranchZ "nodraw"
8964
, Dup
9065
, OutputNum
91-
, PushS
92-
( Literal " " )
66+
, PushS " "
9367
, Call "prints"
9468
, Mark "nodraw"
9569
, Add
96-
( Just
97-
( Literal 1 )
98-
)
70+
( Just 1 )
9971
, Branch "f_start_4"
10072
, Mark "f_finished_4"
10173
, Pop
102-
, Push
103-
( Literal 0 )
74+
, Push 0
10475
, Call "printsln"
10576
, End
10677
, Mark "prints"
@@ -113,8 +84,7 @@
11384
, Return
11485
, Mark "printsln"
11586
, Call "prints"
116-
, Push
117-
( Literal 10 )
87+
, Push 10
11888
, OutputChar
11989
, Return
12090
]

.output/actual/wsa/il/linkLibFile/io.il

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
, Return
99
, Mark "printsln"
1010
, Call "prints"
11-
, Push
12-
( Literal 10 )
11+
, Push 10
1312
, OutputChar
1413
, Return
1514
]

0 commit comments

Comments
 (0)