Skip to content

Commit

Permalink
Simpler DSL for WS
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-adam committed Jan 11, 2025
1 parent a99896e commit cbc57ba
Show file tree
Hide file tree
Showing 77 changed files with 973 additions and 1,413 deletions.
24 changes: 8 additions & 16 deletions .output/actual/wsa/il/linkAppFile/from-eas/bottles.il
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
[ Push
( Literal 3 )
[ Push 3
, Mark "LOOP"
, Dup
, OutputNum
, PushS
( Literal " bottles of beer on the wall, " )
, PushS " bottles of beer on the wall, "
, Call "prints"
, Dup
, OutputNum
, PushS
( Literal " bottles of beer" )
, PushS " bottles of beer"
, Call "printsln"
, PushS
( Literal "Take one down, pass it around" )
, PushS "Take one down, pass it around"
, Call "printsln"
, Push
( Literal 1 )
, Push 1
, Sub Nothing
, Dup
, OutputNum
, PushS
( Literal " bottles of beer on the wall" )
, PushS " bottles of beer on the wall"
, Call "printsln"
, PushS
( Literal "" )
, PushS ""
, Call "printsln"
, Dup
, BranchNZ "LOOP"
Expand All @@ -38,8 +31,7 @@
, Return
, Mark "printsln"
, Call "prints"
, Push
( Literal 10 )
, Push 10
, OutputChar
, Return
]
56 changes: 21 additions & 35 deletions .output/actual/wsa/il/linkAppFile/from-eas/hello.il
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
[ Push
( Literal 32 )
, Push
( Literal 44 )
, Push
( Literal 111 )
, Push
( Literal 108 )
, Push
( Literal 108 )
, Push
( Literal 101 )
, Push
( Literal 72 )
, OutputChar
, OutputChar
, OutputChar
, OutputChar
, OutputChar
, OutputChar
, OutputChar
, Push
( Literal 10 )
, Push
( Literal 33 )
, Push
( Literal 100 )
, Push
( Literal 108 )
, Push
( Literal 114 )
, Push
( Literal 111 )
, Push
( Literal 119 )
[ Push 32
, Push 44
, Push 111
, Push 108
, Push 108
, Push 101
, Push 72
, OutputChar
, OutputChar
, OutputChar
, OutputChar
, OutputChar
, OutputChar
, OutputChar
, Push 10
, Push 33
, Push 100
, Push 108
, Push 114
, Push 111
, Push 119
, OutputChar
, OutputChar
, OutputChar
Expand Down
48 changes: 16 additions & 32 deletions .output/actual/wsa/il/linkAppFile/from-eas/hello2.il
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
[ Push
( Literal 0 )
, Push
( Literal 10 )
, Push
( Literal 33 )
, Push
( Literal 100 )
, Push
( Literal 108 )
, Push
( Literal 114 )
, Push
( Literal 111 )
, Push
( Literal 119 )
, Push
( Literal 32 )
, Push
( Literal 44 )
, Push
( Literal 111 )
, Push
( Literal 108 )
, Push
( Literal 108 )
, Push
( Literal 101 )
, Push
( Literal 72 )
[ Push 0
, Push 10
, Push 33
, Push 100
, Push 108
, Push 114
, Push 111
, Push 119
, Push 32
, Push 44
, Push 111
, Push 108
, Push 108
, Push 101
, Push 72
, Call "prints"
, End
, Mark "prints"
Expand All @@ -40,8 +25,7 @@
, Return
, Mark "printsln"
, Call "prints"
, Push
( Literal 10 )
, Push 10
, OutputChar
, Return
]
6 changes: 2 additions & 4 deletions .output/actual/wsa/il/linkAppFile/from-eas/hello4.il
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[ PushS
( Literal "Hello, world!" )
[ PushS "Hello, world!"
, Call "printsln"
, End
, Mark "prints"
Expand All @@ -12,8 +11,7 @@
, Return
, Mark "printsln"
, Call "prints"
, Push
( Literal 10 )
, Push 10
, OutputChar
, Return
]
6 changes: 2 additions & 4 deletions .output/actual/wsa/il/linkAppFile/from-eas/pip.il
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[ Mark "LOOP"
, Dup
, Push
( Literal 0 )
, Push
( Literal 1 )
, Push 0
, Push 1
, Sub Nothing
, Sub Nothing
, BranchNZ "WRITE"
Expand Down
72 changes: 21 additions & 51 deletions .output/actual/wsa/il/linkAppFile/original/prim.il
Original file line number Diff line number Diff line change
@@ -1,106 +1,77 @@
[ Mark "st"
, PushS
( Literal "prim numbers [2-100]" )
, PushS "prim numbers [2-100]"
, Call "printsln"
, Push
( Literal 0 )
, Push 0
, Mark "f_start_1"
, Test 100
, BranchZ "f_finished_1"
, Dup
, Add
( Just
( Literal 100 )
)
, Push
( Literal 1 )
( Just 100 )
, Push 1
, Store Nothing
, Add
( Just
( Literal 1 )
)
( Just 1 )
, Branch "f_start_1"
, Mark "f_finished_1"
, Pop
, Push
( Literal 2 )
, Push 2
, Mark "f_start_2"
, Test 11
, BranchZ "f_finished_2"
, Push
( Literal 2 )
, Push 2
, Mark "f_start_3"
, Test 100
, BranchZ "f_finished_3"
, Dup
, Push
( Literal 1 )
, Push 1
, Swap
, Store Nothing
, Swap
, Dup
, Push
( Literal 2 )
, Push 2
, Swap
, Store Nothing
, Swap
, Load
( Just
( Literal 1 )
)
( Just 1 )
, Load
( Just
( Literal 2 )
)
( Just 2 )
, Mul Nothing
, Add
( Just
( Literal 100 )
)
, Push
( Literal 0 )
( Just 100 )
, Push 0
, Store Nothing
, Add
( Just
( Literal 1 )
)
( Just 1 )
, Branch "f_start_3"
, Mark "f_finished_3"
, Pop
, Add
( Just
( Literal 1 )
)
( Just 1 )
, Branch "f_start_2"
, Mark "f_finished_2"
, Pop
, Push
( Literal 2 )
, Push 2
, Mark "f_start_4"
, Test 100
, BranchZ "f_finished_4"
, Dup
, Add
( Just
( Literal 100 )
)
( Just 100 )
, Load Nothing
, BranchZ "nodraw"
, Dup
, OutputNum
, PushS
( Literal " " )
, PushS " "
, Call "prints"
, Mark "nodraw"
, Add
( Just
( Literal 1 )
)
( Just 1 )
, Branch "f_start_4"
, Mark "f_finished_4"
, Pop
, Push
( Literal 0 )
, Push 0
, Call "printsln"
, End
, Mark "prints"
Expand All @@ -113,8 +84,7 @@
, Return
, Mark "printsln"
, Call "prints"
, Push
( Literal 10 )
, Push 10
, OutputChar
, Return
]
3 changes: 1 addition & 2 deletions .output/actual/wsa/il/linkLibFile/io.il
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
, Return
, Mark "printsln"
, Call "prints"
, Push
( Literal 10 )
, Push 10
, OutputChar
, Return
]
Loading

0 comments on commit cbc57ba

Please sign in to comment.