Peter
Peter

Reputation: 23

Chicken programming hello world

For 'fun' I'm trying to understand the esoteric programming language Chicken, but just can't seem to get it. The Hello World example is the one I'm trying to fully understand. Many sites refer to torso.me/Chicken, but that site, unfortunately, seems down.

Using the Hello World code available at Esolang, I have a few questions: Q1: At line 12, 13, and 14 there are 10, 17, and 3 chickens. This means I think that 0 will be pushed on the stack, then 7 will be pushed, and then the top two values of the stack will be subtracted from each other, but since we pushed 0 and 7, that will be 7 - 0 = 7. Couldn't line 12 and 14 simply be removed, or am I completely wrong in the interpretation?

Q2: At line 57 there are 8 chickens. So a jump statement. But for a jump statement, only if the condition on the next line is true. The next line has 11 chicken so simply pushes 1 which I assume will always be true, wouldn't this mean it will simply keep looping?

Q3: I think I'm not understanding something fundamentally. Below a simple example code and what I'd expect the program than to do:

12 Chickens = Push 2 => Stack (bottom to top) => 2
15 Chickens = Push 5 => Stack (bottom to top) => 2 - 5
4 Chickens = multiply => Stack (bottom to top) => 10
11 Chickens = Push 1 => Stack (bottom to top) => 10 - 1
6 Chickens = Load next instructions 0 loads from stack
10 Chickens so load from stack top of stack points to stack index => 10 - 1 - 10
15 Chickens = Push 5 => Stack (bottom to top) => 10 - 1 - 10 - 5
12 Chickens = Push 2 => Stack (bottom to top) => 10 - 1 - 10 - 5 - 2
7 Chickens = Store => Stack (bottom to top) => 10 - 5 - 10 - 2
43 Chickens = Push 33 => Stack (bottom to top) => 10 - 5 - 10 - 2 - 33
9 Chickens = char => Stack (bottom to top) => 10 - 5 - 10 - 2 - 33 - !

Any help would be highly appreciated.

Upvotes: 1

Views: 2672

Answers (0)

Related Questions