forked from wspace/corpus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.json
140 lines (140 loc) · 5.06 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
{
"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/wspace/rdebath-c", "https://github.com/rdebath/whitespace"],
"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"] }
],
"extension": "ws"
},
"assembly": {
"mnemonics": {
"push": ["push"],
"dup": ["dup", "doub"],
"copy": ["pick", "copy"],
"swap": ["swap"],
"drop": ["drop", "discard", "pop"],
"slide": ["slide"],
"add": ["add", "add <rhs>"],
"sub": ["sub", "sub <rhs>"],
"mul": ["mul"],
"div": ["div"],
"mod": ["mod"],
"store": ["store", "store <lhs>"],
"retrieve": ["fetch", "retrieve", "retrive", "retrive <number>", "retreive"],
"label": ["<label>:", "label"],
"call": ["call"],
"jmp": ["jump", "jmp"],
"jz": ["jz", "jumpz"],
"jn": ["jn", "jumpn"],
"ret": ["return", "ret"],
"end": ["exit", "quit", "end"],
"printc": ["outc", "outchar", "printc"],
"printi": ["outn", "outnum", "printi"],
"readc": ["readc", "readchar", "inc"],
"readi": ["readn", "readnum", "readi", "inn"],
"dumpstack": ["debug_printstack"],
"dumpheap": ["debug_printheap"]
},
"macros": [
{
"name": "pushs <s>",
"replace": ["push 0", "push <sn>", "…", "push <s1>", "push <s0>"],
"notes": "Uses dup for matching consecutive characters"
},
{ "name": "test <n>", "replace": ["dup", "push <n>", "sub"] },
{ "name": "ifoption <x>", "replace": ["#ifdef <x>"] },
{ "name": "endoption", "replace": ["#endif"] },
{ "name": "include <file>", "replace": ["#include \"<file>.h\""] }
],
"patterns": {
"label": "\\.?[A-Za-z_$][A-Za-z0-9_$]*|[0-9]+",
"number": "-?[0-9]+",
"number_char": "'[^\\]'|'\\[abtn']'",
"string": "\"[^\"]*\""
},
"case_sensitive_mnemonics": false,
"line_comments": [";", "#", "--"],
"block_comments": [{ "start": "{-", "end": "-}", "nestable": false }],
"indentation": " ",
"usage": ["transpiler", "assembler", "enum"]
},
"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"
}
],
"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. The input assembly dialects of wsa and wsa.sed, as well as the output C function calls, are combined in .assembly.mnemonics. Has tests directory that contains Whitespace programs from many authors."
}