04 What is the structure of a Beatnik-Program?

All arithmetic operations in Beatnik are executed on a stack. The only data type of Beatnik is an unsigned 8-bit value, so only values from 0 to 255 can be represented.

Scrabble Values

ValueDEU-ScrabbleENG-Scrabble
1D, A, I, R, T, U, S, N, EE, A, I, O, N, R, T, L, S, U
2G, L, O, HD, G
3W, Z, B, MB, C, M, P
4P, C, F, KF, H, V, W, Y
5K
6J, V, Ä, Ü
8X, ÖJ, X
10Q, YQ, Z

Beatnik-Commands

WordvaluePseudo-CodeExplanation
< 5noopOptional: the interpreter might scoff.
5, npush nPuts the next word on the stack
6popTakes the top value from the stack.
7addTakes two values, adds them and puts the result on the stack.
8inputReads an input and puts the character value on the stack.
9outputTakes the top value from the stack and outputs the corresponding character.
10subTakes two values, subtracts the first value from the second and puts the result on the stack.
11swapSwaps the two top values of the stack.
12doubleTakes the top value from the stack and puts it on the stack twice.
13, njump z  +nTakes the top value from the stack and jumps n places forward if the value is 0.
14, njump nz  +nTakes the top value from the stack and jumps n places forward if the value is not 0.
15, njump z  -nTakes the top value from the stack and jumps n places backward if the value is equal to 0.
16, njump nz  -nTakes the top value from the stack and jumps n places backward if the value is not 0.
17haltTerminates the program.
18 – 23noopOptional: the interpreter might scoff if it is in a bad mood.
> 23noopThe interpreter applauds the programmer for the high score.