Add some (very) failing tests.
Cat's Eye Technologies
8 years ago
5 | 5 | |
6 | 6 | GraNoLa/M is a programming language that owes much of its heritage to |
7 | 7 | Tamerlane and Q-BAL, but hints of BASIC, LISP, FORTH, SETL, Muriel, and |
8 | Aardappel can be detected in faint outline. It widely believed to be a | |
8 | Aardappel can be detected in faint outline. It is widely believed to be a | |
9 | 9 | subset of a much larger, PL/I-like language called 'GraNoLa/88800'. |
10 | 10 | |
11 | 11 | Data Types |
57 | 57 | --------- |
58 | 58 | |
59 | 59 | All GraNoLa/M operations work on graphs. Actually they work on an |
60 | internal stack of graphs - actually the stack is nothing more than a | |
60 | internal stack of graphs — actually the stack is nothing more than a | |
61 | 61 | graph, but to avoid (and cause) confusion, we will call it a stack, |
62 | 62 | because mainly we are concerned with putting things into it and getting |
63 | 63 | things off of it. |
100 | 100 | Operations |
101 | 101 | ---------- |
102 | 102 | |
103 | * #label - push a nub onto the stack | |
104 | * 0label - push an empty graph (node) onto the stack | |
105 | * 1label - copy node with label from program onto stack | |
106 | * @label - set the cursor to label | |
107 | * whebong - push current (sub)program onto stack | |
108 | * duronilt - pop graph and replace current (sub)program with it | |
109 | * chehy - pop graph off of stack and use it as new stack | |
110 | * taug - push stack onto stack embedded into a new node | |
111 | * soduv - pop a graph, set execution order to first if it is empty, last if not | |
112 | * rehohur - pop and discard graph | |
113 | * bimodang - pop label and jump to it as subroutine in current program graph | |
114 | * ubewic - return from current subroutine (jump back to last bimodang) | |
115 | * chuwakagathaz - switch to nondeterministic execution order (default) | |
116 | * sajalom - deterministic execution order - use first edge | |
117 | * grangnum - deterministic execution order - use last edge | |
118 | * uwaming - pop a graph off the stack and print it | |
119 | * bejadoz - input a graph (in GraNoLa/M syntax) and push it on the stack | |
103 | * `#`label - push a nub onto the stack | |
104 | * `0`label - push an empty graph (node) onto the stack | |
105 | * `1`label - copy node with label from program onto stack | |
106 | * `@`label - set the cursor to label | |
107 | * `whebong` - push current (sub)program onto stack | |
108 | * `duronilt` - pop graph and replace current (sub)program with it | |
109 | * `chehy` - pop graph off of stack and use it as new stack | |
110 | * `taug` - push stack onto stack embedded into a new node | |
111 | * `soduv` - pop a graph, set execution order to first if it is empty, last if not | |
112 | * `rehohur` - pop and discard graph | |
113 | * `bimodang` - pop label and jump to it as subroutine in current program graph | |
114 | * `ubewic` - return from current subroutine (jump back to last bimodang) | |
115 | * `chuwakagathaz` - switch to nondeterministic execution order (default) | |
116 | * `sajalom` - deterministic execution order - use first edge | |
117 | * `grangnum` - deterministic execution order - use last edge | |
118 | * `uwaming` - pop a graph off the stack and print it | |
119 | * `bejadoz` - input a graph (in GraNoLa/M syntax) and push it on the stack | |
120 | 120 | |
121 | Tests | |
122 | ||
123 | -> Functionality "Interpret GraNoLa/M Program" is implemented by | |
124 | -> shell command "bin/granolam %(test-body-file)" | |
125 | ||
126 | -> Tests for functionality "Interpret GraNoLa/M Program" | |
127 | ||
128 | | a=^#cthulhu(b=^uwaming(^a)) | |
129 | = ?? | |
130 | ||
131 | | a=^whebong(b=^uwaming(^a)) | |
132 | = ?? | |
133 | ||
134 | | a=^0hello(b=^@hello(c=^taug(d=^uwaming(^a)))) | |
135 | = ?? | |
136 | ||
137 | | a=^1hello(b=^uwaming(end=() hello=(world()))) | |
138 | = ?? | |
139 | ||
140 | | a=^sajalom(b=^#d(c=^bimodang(^a)) | |
141 | = ?? | |
142 | ||
143 | | d(e=^#sakura(f=^uwaming(g=^ubewic())))) | |
144 | = ?? | |
145 | ||
146 | | a=^sajalom(b=^bejadoz(c=^soduv(^a d()))) | |
147 | = ?? |