/
99bob.hence
38 lines (28 loc) · 868 Bytes
/
99bob.hence
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
number-of-bottles
subtract '1' [from] depth
value-of
get
bottles-remaining
[compare] value-of 'number-of-bottles' [and] '0'
[return number of bottles is] greater-than [0]
take-one-down
decrement-variable 'number-of-bottles'
write-s
write 's'
write-number-of-bottles
write value-of 'number-of-bottles'
write ' bottle'
[compare] value-of 'number-of-bottles' [and] '1'
if [number of bottles is] 'not-equal' [to 1] 'write-s' [else] 'do-nothing'
write [TOS]
write-verse
write-number-of-bottles ' of beer on the wall, '
write-number-of-bottles ' of beer.\n'
write 'Take one down and pass it around, '
take-one-down
write-number-of-bottles ' of beer on the wall.\n\n'
main
reserve '1' [element at bottom-of-stack for number-of-bottles]
set 'number-of-bottles' [to] '99'
while 'bottles-remaining' 'write-verse'
[return] '0'