-
Notifications
You must be signed in to change notification settings - Fork 3
/
project.json
249 lines (249 loc) · 8.63 KB
/
project.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
{
"id": "c/rdebath",
"name": "Whitespace",
"authors": ["Robert de Bath"],
"license": "none",
"languages": ["C", "Lex"],
"tags": ["transpiler", "interpreter", "assembler", "program builder", "programs"],
"date": "2015-08-18 14:25:03 +0100",
"spec_version": "0.3",
"source": ["https://github.com/rdebath/whitespace", "https://github.com/wspace/rdebath-c"],
"submodules": [{ "path": "whitespace", "url": "https://github.com/wspace/rdebath-c" }],
"whitespace": {
"nonstandard": [
{ "name": "jzp", "aliases": ["jumppz"], "args": ["label"] },
{ "name": "jzn", "aliases": ["jumpnz"], "args": ["label"] },
{ "name": "jp", "aliases": ["jumpp"], "args": ["label"] },
{ "name": "jnz", "aliases": ["jumppn", "jumpnp"], "args": ["label"] },
{ "name": "trace", "args": ["number"] }
],
"extension": "ws"
},
"assembly": [
{
"source": "ws_engine.h, ws_gencode.h, and ws2c.c",
"mnemonics": {
"push": "push",
"dup": "dup",
"copy": "pick",
"swap": "swap",
"drop": "drop",
"slide": "slide",
"add": "add",
"sub": "sub",
"mul": "mul",
"div": "div",
"mod": "mod",
"store": "store",
"retrieve": "fetch",
"label": "label",
"call": "call",
"jmp": "jump",
"jz": "jz",
"jn": "jn",
"ret": "return",
"end": "exit",
"printc": "outc",
"printi": "outn",
"readc": "readc",
"readi": "readn"
},
"macros": [{ "name": "pushs" }, { "name": "jp" }, { "name": "jzp" }, { "name": "jzn" }, { "name": "jnz" }],
"usage": ["interpreter", "program builder"],
"notes": "Has `trace` extension instruction"
},
{
"source": "wsa.l",
"mnemonics": {
"push": "push <number>",
"dup": "dup",
"copy": ["copy <number>", "pick <number>"],
"swap": "swap",
"drop": ["drop", "discard"],
"slide": "slide <number>",
"add": "add",
"sub": "sub",
"mul": "mul",
"div": "div",
"mod": "mod",
"store": "store",
"retrieve": ["fetch", "retrieve", "retrive", "retreive"],
"label": ["<label_number>:", "<label_name><optional_space>:", "label <label>"],
"call": "call <label>",
"jmp": ["jmp <label>", "jump <label>"],
"jz": "jz <label>",
"jn": "jn <label>",
"ret": ["ret", "return"],
"end": ["quit", "exit", "end"],
"printc": ["outc", "outchar", "printc"],
"printi": ["outn", "outnum", "printi"],
"readc": ["readc", "readchar"],
"readi": ["readn", "readnum", "readi"]
},
"patterns": {
"label": "<label_number>|<label_name>",
"label_name": "\\.?[A-Za-z_$][A-Za-z0-9_$]*",
"label_number": "[0-9]+",
"number": "-?[0-9]+|'[^\\\n']'|'\\[ntab']'",
"optional_space": "[ \t]*",
"space": "[ \t]+"
},
"line_comments": [";", "#"],
"indentation": "",
"usage": ["assembler"]
},
{
"source": "wsa.sed",
"mnemonics": {
"push": "push <signed_number>",
"dup": "doub",
"swap": "swap",
"drop": "pop",
"add": ["add", "add <unsigned_number>"],
"sub": ["sub", "sub <unsigned_number>"],
"mul": "mul",
"div": "div",
"mod": "mod",
"store": ["store", "store <unsigned_number>"],
"retrieve": ["retrive", "retrive <unsigned_number>"],
"label": "label <label>",
"call": "call <label>",
"jmp": "jump <label>",
"jz": "jumpz <label>",
"jn": "jumpn <label>",
"ret": "ret",
"end": "exit",
"printc": "outC",
"printi": "outN",
"readc": "InC",
"readi": "InN",
"dumpstack": "debug_printstack",
"dumpheap": "debug_printheap"
},
"macros": [
{ "name": "jumppz <label>" },
{ "name": "jumpnz <label>" },
{ "name": "jumpp <label>" },
{ "name": "jumppn <label>" },
{ "name": "jumpnp <label>" },
{
"name": "pushs <string>",
"replace": ["push 0", "push <sn>", "…", "push <s1>", "push <s0>"],
"notes": "Uses dup for matching consecutive characters"
},
{ "name": "test <unsigned_number>", "replace": ["dup", "push <unsigned_number>", "sub"] },
{ "name": "ifoption <label>", "replace": ["#ifdef <label>"] },
{ "name": "endoption", "replace": ["#endif"] },
{ "name": "include <label>", "replace": ["#include \"<label>.h\""] }
],
"patterns": {
"label": "[A-Za-z][A-Za-z0-9_]*",
"signed_number": "-?[0-9]+",
"string": "\"[^\"]*\"",
"unsigned_number": "[0-9]+"
},
"line_comments": ["--", ";"],
"block_comments": [{ "start": "{-", "end": "-}", "nestable": false }],
"usage": ["assembler"],
"notes": "outN, outC, InC, and InN are case-insensitive; the reset are case-sensitive."
}
],
"programs": [
{
"path": "gencode-deadfish-in-ws.c",
"generated": "deadfish.ws",
"spec_version": "0.2",
"generate": "gcc -o gencode-deadfish-in-ws gencode-deadfish-in-ws.c && ./gencode-deadfish-in-ws > deadfish.ws"
},
{
"path": "gen-99bottles.c",
"generated": "99bottles.ws",
"spec_version": "0.2",
"generate": "gcc -o gen-99bottles gen-99bottles.c && ./gen-99bottles > 99bottles.ws"
},
{
"path": "gen-prime.c",
"generated": "prime.ws",
"spec_version": "0.2",
"generate": "gcc -o gen-prime gen-prime.c && ./gen-prime > prime.ws"
},
{
"path": "gen-wsinterws.c",
"generated": "wsinterws.ws",
"spec_version": "0.2",
"generate": "gcc -o gen-wsinterws gen-wsinterws.c && ./gen-wsinterws > wsinterws.ws"
},
{ "path": "io.h", "spec_version": "0.2" },
{ "path": "memory.h", "spec_version": "0.2" },
{ "path": "tests/AndrewKemp/99bottles.ws" },
{ "path": "tests/Burghard/endquitend.ws" },
{ "path": "tests/Burghard/prime.ws" },
{ "path": "tests/Burghard/wsinterws-orig.ws" },
{ "path": "tests/Burghard/wsinterws.ws" },
{ "path": "tests/Tetris/tetris.ws" },
{ "path": "tests/Vii5ard/bf.ws" },
{ "path": "tests/Vii5ard/c.ws" },
{ "path": "tests/Vii5ard/fibonacci.ws" },
{ "path": "tests/Vii5ard/hanoi.ws" },
{ "path": "tests/Vii5ard/nerd.ws" },
{ "path": "tests/Vii5ard/quine-2.ws" },
{ "path": "tests/Vii5ard/quine.ws" },
{ "path": "tests/WSpace-0.3/calc.ws" },
{ "path": "tests/WSpace-0.3/count.ws" },
{ "path": "tests/WSpace-0.3/fact.ws" },
{ "path": "tests/WSpace-0.3/hanoi.ws" },
{ "path": "tests/WSpace-0.3/hworld.ws" },
{ "path": "tests/WSpace-0.3/loctest.ws" },
{ "path": "tests/WSpace-0.3/name.ws" },
{ "path": "tests/rdebath/cellsize.ws" },
{ "path": "tests/rdebath/hello2.ws" },
{ "path": "tests/rdebath/helloworld.ws" },
{
"path": "tests/whitespacers/sudoku.ws",
"inputs": ["tests/whitespacers/sudoku.in"],
"outputs": ["tests/whitespacers/sudoku.txt"]
}
],
"commands": [
{
"type": "transpiler",
"bin": "ws2c",
"usage": "$0 [-r | -c] [-v...] [-q] [-e | -z | -n] [-d] [-old] [--] [<file>]",
"options": [
{ "short": "r", "desc": "Interpret now" },
{ "short": "c", "desc": "Compile to C" },
{ "short": "v", "desc": "Print a single comment line; repeat to print more lines" },
{ "short": "q", "desc": "Disable warnings" },
{ "short": "e", "desc": "-1 on EOF (not implemented)" },
{ "short": "z", "desc": "0 on EOF (not implemented)" },
{ "short": "n", "desc": "1 on EOF (not implemented)" },
{ "short": "d", "desc": "Debug mode" },
{ "short": "old", "desc": "Disable Whitespace 0.3 features" }
],
"option_parse": "manual",
"notes": "Interprets program when no flags given. Reconstructs ASCII label strings of the form that were of the form [A-Za-z_][A-Za-z0-9_]* from numbers."
},
{
"type": "interpreter",
"bin": "wsc.sh",
"usage": "$0 <file> [<CFLAGS> [<LDFLAGS>]]",
"output": "stdout",
"notes": "Compiles and runs program"
},
{
"type": "assembler",
"bin": "wsa",
"usage": "$0 [<file>...]",
"output": "stdout",
"notes": "Assembles other Whitespace assembly dialects"
},
{
"type": "assembler",
"bin": "wsa.sed",
"usage": "sed -f $0 <file>",
"output": "stdout",
"notes": "Assembles Oliver Burghard's Whitespace assembly dialect, including shorthand instructions"
}
],
"notes": "Transpiles to C. Has tests directory that contains Whitespace programs from many authors."
}