chicken-php icon indicating copy to clipboard operation
chicken-php copied to clipboard

[Question] How to loop in Chicken?

Open einsteinsci opened this issue 9 years ago • 1 comments

I'm trying to write an interpreter for Chicken in C#, and while creating the "Fr"/"Jump" instruction, I noticed that it jumps relative to the instruction pointer's current position, rather than to an absolute position in the stack. Since values in Chicken can only be positive (due to the fact that you can't put a negative number of the word "Chicken" on a line), how could a program jump backward to run previous instructions repeatedly?

If you have an example, I would prefer Eggsembly rather than compiled Chicken.

einsteinsci avatar Jun 25 '16 19:06 einsteinsci

You can have negative numbers:

push 0 push 1 fox

fabiolmorato avatar Dec 06 '18 14:12 fabiolmorato