Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ChickenVM (jszurich)

ChickenVM (jszurich)

Igor Wiedler

August 27, 2013
Tweet

More Decks by Igor Wiedler

Other Decks in Programming

Transcript

  1. Chicken Chicken Chicken: Chicken Chicken Doug Zongker University of Washington

    Chicken Chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken. Chicken chicken chicken chicken chicken chicken chicken chicken. Chicken, chicken chicken chicken, chicken chicken, chic- ken chicken chicken “chicken chicken” chicken “chicken chicken” chicken. Chicken, chicken chicken chicken chicken chicken chi- cken (chicken chicken) chicken chicken chicken chicken chicken, chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken. Chicken chicken chicken chicken chicken chicken chicken chicken chicken, chicken chicken chicken, chicken chicken chicken chicken chicken chicken chicken. CC Chickens: C.3.2 [Chickens]: Chicken Chickens—chicken/chicken chicken; C.3.4 [Chicken chicken]: Chicken chicken chicken—chickens; C.2.4 [Chicken-chicken chickens]: Chicken/Chicken, chicken chickens Chickens: chicken, chicken chicken, chicken, chicken 1 Chicken Chicken chicken, chicken, chicken chicken chicken chicken, chic- ken chicken chicken chicken chicken chicken [4]. Chicken chicken chicken chicken, chicken chicken chicken: chicken chicken chic- ken chicken chicken chicken chicken chicken chicken. (chicken chicken chicken chicken chicken chicken, chicken chicken chicken chicken chicken chicken chicken!) Chicken, chicken-chicken chicken chicken—chicken chicken, chi- cken chicken 95% chicken chicken-chicken chicken, chicken chic- ken chicken chicken—chicken chicken chicken chicken. Chicken, chicken chicken, chicken chicken chicken 1987. Chicken chicken chicken chicken chicken chicken-chicken-chicken chicken chicken chicken chicken chicken chicken, chicken chicken chicken chicken chicken chicken chicken. Chicken chicken, chicken chicken ch- icken chicken chicken chicken chicken (chicken chicken chicken chicken chicken, chicken chicken chicken chicken chicken chicken chicken chicken). Chicken chicken chicken chicken chicken chicken, chicken chicken (chicken chicken chicken chicken chicken chicken) chicken chic- ken chickens chicken. Chicken chickens chicken chicken chicken chicken chicken “chicken” chicken chickens chicken. Chicken ch- icken, chicken-chicken chicken chickens, chicken chicken chicken chicken chicken chicken chicken.1 Chicken chicken’s “chicken” chicken chicken chicken chicken—chicken chicken chicken chic- ken chicken chicken, chicken chicken chicken chicken chicken ch- icken. 1Chicken chicken chicken chicken chicken chicken chicken; chicken chickens. Chicken chicken Chicken [5]. + Chicken? Chicken Chicken Chicken Chicken Chicken, chicken, chicken Chicken Chicken Chicken Chicken/chicken chicken Chicken chicken chicken C C Chicken chicke n chicken chicken Chicken 1 Chicken chicken chicken. Chicken chicken, chicken chicken (chic- ken chicken chicken) chicken chicken-chicken. Chicken chicken chicken chicken chicken. Chicken-chicken chic- ken chicken chicken chicken chicken chicken, chicken chicken chi- cken chicken, chicken, chicken chicken chicken “chicken” chicken. Chicken chicken chicken chicken chicken chicken chicken, chic- ken, chicken chicken. Chicken chicken, chicken chicken chicken chicken chicken, chicken chicken chicken chicken chicken chicken (chicken, chicken-chicken chicken chicken chicken-chicken chic- ken chicken-chicken chicken). Chicken, chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken. Chicken chicken chicken chicken chicken chicken, chicken chic- ken chicken chicken chicken chicken chicken chicken chicken (ch- icken). Chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken, chicken chicken chicken, chicken, chicken chicken chicken chicken. Chicken chicken chicken, chicken chicken chicken, chicken chic- ken chickens chicken chicken chicken chicken. Chicken, chicken chicken chicken chicken chicken chicken chicken-chicken chicken, chicken chicken chickens Chicken 2. Chicken chicken chicken ch- icken chicken chicken chicken chicken chicken, chicken chicken chicken, chicken chickens chicken. Chicken chicken chicken chic- ken chicken chicken chicken chicken (chicken chicken Chicken 3), chicken chickens chicken chicken chicken (Chicken 4). Chicken chicken chicken chicken chicken, chicken chicken chickens chic- ken, chicken chicken chickens chickens chicken. Chicken chicken chicken chicken chicken chicken chicken. 2 Chicken chicken Chicken chicken chicken, C(n) chicken chicken chicken chicken chicken chicken chicken [4]. Chicken chicken chicken chicken ch- icken’s chickens Chicken [3] chicken chicken, chicken chicken ch-
  2. function chicken(CHICKEN, Chicken) { Chicken &&( chicken. chicken =[, CHICKEN,

    CHICKEN = Chicken = chicken. $Chicken =-( CHICKEN ==( chicken. Chicken = Chicken ))], chicken. chicken [Chicken++] = chicken. chicken, chicken. CHICKEN = ++Chicken, chicken (--Chicken), chicken. $Chicken = ++Chicken, chicken. CHICKEN++ ); Chicken = chicken. Chicken [chicken. $Chicken++ ]; chicken. Chicken = CHICKEN? Chicken? '\012'== Chicken? chicken (++ CHICKEN, chicken. chicken [++ chicken. CHICKEN ]= CHICKEN - CHICKEN ): Chicken ==' '|'\015'== Chicken || (Chicken )== "c" & chicken. Chicken [chicken. $Chicken++ ]== "h" & chicken. Chicken [chicken. $Chicken++ ]== "i" & chicken. Chicken [chicken. $Chicken++ ]== "c" & chicken. Chicken [chicken. $Chicken++ ]== "k" & chicken. Chicken [chicken. $Chicken++ ]== "e" & chicken. Chicken [chicken. $Chicken++ ]== "n"&&++chicken. chicken [chicken. CHICKEN]? chicken (CHICKEN) :[ "Error on line "+CHICKEN+": expected 'chicken'", chicken. CHICKEN = CHICKEN ++- CHICKEN ]: chicken. chicken :( CHICKEN = chicken. Chicken[chicken.CHICKEN], Chicken? (Chicken = } --Chicken? --Chicken? --Chicken? --Chicken? --Chicken? --Chicken? --Chicken? --Chicken? --Chicken? chicken. CHICKEN++ && --Chicken :'&#'+CHICKEN+';': chicken. Chicken [chicken. Chicken [-- chicken. CHICKEN ]&& (chicken. $Chicken += CHICKEN), --chicken. CHICKEN ]: chicken. Chicken [chicken. Chicken [CHICKEN] = chicken. Chicken [-- chicken. CHICKEN ],-- chicken. CHICKEN ]: chicken. Chicken [chicken. Chicken [chicken. $Chicken++ ]] [CHICKEN]: CHICKEN == chicken. Chicken [-- chicken. CHICKEN ]: CHICKEN*chicken. Chicken [-- chicken. CHICKEN ]: chicken. Chicken [-- chicken. CHICKEN ]- CHICKEN: chicken. Chicken [-- chicken. CHICKEN ]+ CHICKEN: chicken. CHICKEN ++ && "chicken", chicken. Chicken [chicken. CHICKEN ]= Chicken, chicken ()): CHICKEN ); return chicken. Chicken
  3. cat chicken chicken chicken chicken chicken chicken chicken chicken chicken

    chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊
  4. Spec Every line in the program is inspected for chickens,

    and the corresponding number of chickens are pushed onto the stack. Execution is done directly on the stack, which may make the program susceptible to arbitrary chicken injection attacks.
  5. 0 axe Terminates all chickens. 1 chicken Pushes “chicken” onto

    the stack. 2 add Adds two topmost groups of chickens. 3 fox Topmost chickens become foxes. Subtract. 4 rooster Causes two topmost groups to multiply. 4.5 fence Divides chickens. Cannot be used. 5 compare Compares, pushes truthy or falsy chicken. 6 pick Pop address, pop source. 0 stack, 1 input. 7 peck Pop address, store value. 8 fr Pop offset, pop cond. If cond, fly to offset. 9 BBQ Chars the topmost group into ASCII. n Pushes n-10 chickens onto the stack.
  6. • Same variables with different case or prefix • Long

    chains of conditional evaluation • Increment, decrement, parentheses, commas, ternaries • Variable re-definition • Store values on the function object • Recursion
  7. function chicken(CHICKEN, Chicken) { Chicken && (chicken.chicken = [, CHICKEN,

    CHICKEN = Chicken = chicken.$Chicken = -(CHICKEN == (chicken.Chicken = Chicken)) ], chicken.chicken[Chicken++] = chicken.chicken, chicken.CHICKEN = ++Chicken, chicken(--Chicken), chicken. $Chicken = ++Chicken, chicken.CHICKEN++); Chicken = chicken.Chicken[chicken.$Chicken++]; chicken.Chicken = CHICKEN ? Chicken ? '\012' == Chicken ? chicken(++CHICKEN, chicken.chicken[++chicken.CHICKEN] = CHICKEN - CHICKEN) : Chicken == ' ' | '\015' == Chicken || (Chicken) == "c" & chicken.Chicken[chicken.$Chicken++] == "h" & chicken.Chicken[chicken.$Chicken++] == "i" & chicken.Chicken[chicken.$Chicken++] == "c" & chicken.Chicken[chicken.$Chicken++] == "k" & chicken.Chicken[chicken.$Chicken++] == "e" & chicken.Chicken[chicken.$Chicken++] == "n" && + +chicken.chicken[chicken.CHICKEN] ? chicken(CHICKEN) : ["Error on line " + CHICKEN + ": expected 'chicken'", chicken.CHICKEN = CHICKEN++-CHICKEN ] : chicken.chicken : (CHICKEN = chicken.Chicken[chicken.CHICKEN], Chicken ? (Chicken = --Chicken ? --Chicken ? --Chicken ? --Chicken ? --Chicken ? --Chicken ? --Chicken ? --Chicken ? --Chicken ? chicken.CHICKEN++ && --Chicken : '&#' + CHICKEN + ';' : chicken.Chicken[chicken.Chicken[--chicken.CHICKEN] && (chicken.$Chicken += CHICKEN), --chicken.CHICKEN] : chicken.Chicken[chicken.Chicken[CHICKEN] = chicken.Chicken[--chicken.CHICKEN], --chicken.CHICKEN] : chicken.Chicken[chicken.Chicken[chicken.$Chicken++]][CHICKEN] : CHICKEN == chicken.Chicken[-- chicken.CHICKEN] : CHICKEN * chicken.Chicken[--chicken.CHICKEN] : chicken.Chicken[--chicken.CHICKEN] - CHICKEN : chicken.Chicken[--chicken.CHICKEN] + CHICKEN : chicken.CHICKEN++ && "chicken", chicken.Chicken[chicken.CHICKEN] = Chicken, chicken()) : CHICKEN); return chicken.Chicken }
  8. function chicken(code, input) { if (input) { chicken.chicken = [

    , code, code = input = chicken.$Chicken = -(code == (chicken.Chicken = input)) ]; chicken.chicken[input++] = chicken.chicken; chicken.CHICKEN = ++input; chicken(--input); chicken.$Chicken = ++input; chicken.CHICKEN++; }
  9. • Restructure • Step through debugger • Stare until eyes

    fall out • Rename variable • Rinse, repeat... Strategy
  10. var code = "", stack = [], $sp = -1,

    $ip = 0, $cp = 0; function inc() { stack[$sp]++; return true; } function push(value) { stack[++$sp] = value; } function pop() { return stack[$sp--]; } function peek() { return stack[$sp]; }
  11. function chicken(input, le_code) { code = le_code; $cp = 0;

    $sp = -1; stack = []; push(stack); push(input); push(0); read_line(1); return run_loop(); }
  12. function read_line(line) { var character = code[$cp++]; if (!character) {

    return; } if ('\012' == character) { // LF line++; push(0); return read_line(line); } if (character == ' ' || (character == "c" && code[$cp++] == "h" && code[$cp++] == "i" && code[$cp++] == "c" && code[$cp++] == "k" && code[$cp++] == "e" && code[$cp++] == "n") && inc()) { return read_line(line); } $sp = 0; stack = [ 0x0, "Error on line "+line+": expected 'chicken'" ]; }
  13. function run_loop() { var instruction; $ip = 2; push(0); while

    (instruction = stack[$ip++]) { process_instruction(instruction); } return peek(); }
  14. function process_instruction(instruction) { var head; switch (instruction) { case 1:

    push("chicken"); break; case 2: head = pop(); push(pop() + head); break; case 3: head = pop(); push(pop() - head); break; case 4: push(pop() * pop()); break; case 5: push(pop() == pop()); break; case 6: head = pop(); push(stack[stack[$ip++]][head]); break; case 7: head = pop(); stack[head] = pop(); break; case 8: head = pop(); if (pop()) { $ip += head; } break; case 9: push('&#'+pop()+';'); break; default: push(instruction - 10); break; } }
  15. &stack &input 0 ip sp chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊
  16. &stack &input 0 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  17. &stack &input 1 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  18. &stack &input 2 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  19. &stack &input 3 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  20. &stack &input 4 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  21. &stack &input 5 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  22. &stack &input 6 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  23. &stack &input 7 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  24. &stack &input 8 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  25. &stack &input 9 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  26. &stack &input 10 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  27. &stack &input 11 sp chicken chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  28. &stack &input 11 0 sp chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  29. &stack &input 11 1 sp chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  30. &stack &input 11 2 sp chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  31. &stack &input 11 3 sp chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  32. &stack &input 11 4 sp chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  33. &stack &input 11 5 sp chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  34. &stack &input 11 6 sp chicken chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  35. &stack &input 11 6 0 sp chicken chicken chicken chicken

    chicken chicken chicken chicken chicken chicken chicken ␊ chicken chicken chicken chicken chicken chicken ␊ ip
  36. &stack &input 11 6 0 sp set the code pointer

    to the beginning of the code segment ip
  37. &stack &input 11 6 0 0 1 sp 6, 0

    = load stack[0] ip source
  38. &stack &input 11 6 0 0 &input return head of

    stack to caller which is: &input ip sp
  39. push 5 push 13 rooster bbq axe chicken chicken chicken

    chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken␊ chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken␊ chicken chicken chicken chicken␊ chicken chicken chicken chicken chicken chicken chicken chicken chicken␊ eggsemble
  40. push 5 push 13 rooster bbq axe push 5 push

    13 multiply char exit chicken asm
  41. &stack &input ... ... ... ip push 0 push 2

    store push 0 push 32 char add push 3 store 3 sp
  42. &stack &input ... ... ... ip push 0 push 2

    store push 0 push 32 char add push 3 store write 0 into register 2 } 3 sp
  43. &stack &input 0 ... ... ip push 0 push 2

    store push 0 push 32 char add push 3 store i 3 write 0 into register 2 } sp
  44. &stack &input 0 ... ... ip push 0 push 2

    store push 0 push 32 char add push 3 store write “0<space>” into register 3 } i 3 write 0 into register 2 } sp
  45. &stack &input 0 “0 “ ... ip push 0 push

    2 store push 0 push 32 char add push 3 store i out 3 write 0 into register 2 } write “0<space>” into register 3 } sp
  46. &stack &input 0 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 3 sp
  47. &stack &input 0 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } 3 sp
  48. &stack &input 0 “0 “ ... 0 sp ip i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } 3
  49. &stack &input 0 “0 “ ... 0 ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 sp
  50. &stack &input 0 “0 “ ... 0 3 sp ip

    i out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3
  51. &stack &input 0 “0 “ ... 0 3 ip i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } sp
  52. &stack &input 0 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } false sp
  53. &stack &input 0 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } false if true, jump to end } sp
  54. &stack &input 0 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } false if true, jump to end } sp
  55. &stack &input 0 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } if true, jump to end } sp
  56. &stack &input 0 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } if true, jump to end } load register 2 i } sp
  57. &stack &input 0 “0 “ ... 0 ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } if true, jump to end } load register 2 i } sp
  58. &stack &input 0 “0 “ ... 0 ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } if true, jump to end } load register 2 i } increment } sp
  59. &stack &input 0 “0 “ ... 1 ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } if true, jump to end } load register 2 i } increment } sp
  60. &stack &input 0 “0 “ ... 1 ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } if true, jump to end } load register 2 i } increment } store register 2 i } sp
  61. &stack &input 1 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 load register 2 i } load register 1 input } 3 compare } if true, jump to end } load register 2 i } increment } store register 2 i } sp
  62. &stack &input 1 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } sp
  63. &stack &input 1 “0 “ ... ip i out push

    2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } append “i<space>” to out } sp
  64. &stack &input 1 “0 1 “ ... ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out sp
  65. &stack &input 1 “0 1 “ ... ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } sp
  66. &stack &input 1 “0 1 “ ... ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } sp
  67. &stack &input 1 “0 1 “ ... ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } sp
  68. &stack &input 1 “0 1 “ ... ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } sp
  69. &stack &input 1 “0 1 “ ... ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } false sp
  70. &stack &input 1 “0 1 “ ... ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } sp
  71. &stack &input 2 “0 1 “ ... ip i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } sp
  72. &stack &input 2 “0 1 2 “ ... ip i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } sp
  73. &stack &input 2 “0 1 2 “ ... i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  74. &stack &input 2 “0 1 2 “ ... i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  75. &stack &input 2 “0 1 2 “ ... i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  76. &stack &input 2 “0 1 2 “ ... i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip false sp
  77. &stack &input 2 “0 1 2 “ ... i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  78. &stack &input 3 “0 1 2 “ ... i out

    push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  79. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  80. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  81. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  82. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  83. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip true sp
  84. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  85. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  86. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip sp
  87. &stack &input 3 “0 1 2 3 “ ... i

    out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip load out } sp
  88. &stack &input 3 “0 1 2 3 “ ... “0

    1 2 3 “ i out push 2 load 0 push 1 load 0 compare push 24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 } 3 compare i to input if true, jump to end } increment i } }append “i<space>” to out jump to start } ip load out } sp
  89. &stack &input 3 “0 1 2 3 “ ... “0

    1 2 3 “ i out 3 “0 1 2 3 “ is returned to caller sp
  90. push 2 load 0 push 1 load 0 compare push

    24 jump push 2 load 0 push 1 add push 2 store push 3 load 0 push 2 load 0 add push 32 char add push 3 store push 1 push 0 push 33 subtract jump push 3 load 0 loop break
  91. &stack &input ... ... ip push 11 push 12 push

    2 push 0 push 1 push 1 jump sp
  92. &stack &input ... ... 11 ip push 11 push 12

    push 2 push 0 push 1 push 1 jump sp
  93. &stack &input ... ... 11 12 ip push 11 push

    12 push 2 push 0 push 1 push 1 jump sp
  94. &stack &input ... ... 11 12 2 ip push 11

    push 12 push 2 push 0 push 1 push 1 jump sp
  95. &stack &input ... ... 11 12 2 0 ip push

    11 push 12 push 2 push 0 push 1 push 1 jump sp
  96. &stack &input ... ... 11 12 2 0 ip push

    11 push 12 push 2 push 0 push 1 push 1 jump sp ip
  97. &stack &input ... ... 11 12 2 0 ip push

    11 push 12 push 2 push 0 push 1 push 1 jump sp ip
  98. v @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^
  99. v @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ ip
  100. v @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ ip
  101. v @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 ip
  102. v @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 0 ip
  103. v @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 0 0 ip
  104. v @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 0 0 ip
  105. 3 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ ip [n]
  106. 3 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 ip [n]
  107. 3 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 1 ip [n]
  108. 3 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 1 0 ip [n]
  109. 3 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 1 0 ip [n]
  110. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ ip [n,i]
  111. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 ip [n,i]
  112. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ ip [n,i] Output: 0
  113. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ ip [n,i] Output: 0
  114. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 32 ip [n,i] Output: 0
  115. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 32 ip [n,i] Output: 0
  116. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ ip [n,i] Output: 0
  117. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ ip [n,i] Output: 0
  118. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 ip [n,i] Output: 0
  119. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 0 ip [n,i] Output: 0
  120. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 ip [n,i] Output: 0
  121. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 1 ip [n,i] Output: 0
  122. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 1 0 ip [n,i] Output: 0
  123. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 0 ip [n,i] Output: 0
  124. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 0 ip [n,i] Output: 0
  125. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 ip
  126. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 ip
  127. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 ip
  128. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 ip
  129. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 [n,i] Output: 0 ip
  130. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 0 [n,i] Output: 0 ip
  131. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 [n,i] Output: 0 ip
  132. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 1 [n,i] Output: 0 ip
  133. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 [n,i] Output: 0 ip
  134. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 1 [n,i] Output: 0 ip
  135. 30 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 1 0 [n,i] Output: 0 ip
  136. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 ip
  137. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 [n,i] Output: 0 ip
  138. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 0 [n,i] Output: 0 ip
  139. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 [n,i] Output: 0 ip
  140. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  141. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  142. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 32 [n,i] Output: 0 1 ip
  143. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  144. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  145. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  146. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 ip [n,i] Output: 0 1
  147. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 0 0 ip [n,i] Output: 0 1
  148. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 ip [n,i] Output: 0 1
  149. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 1 ip [n,i] Output: 0
  150. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 1 0 ip [n,i] Output: 0 1
  151. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 1 ip [n,i] Output: 0 1
  152. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 1 [n,i] Output: 0 1 ip
  153. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  154. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  155. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  156. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  157. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 [n,i] Output: 0 1 ip
  158. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 0 [n,i] Output: 0 1 ip
  159. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 [n,i] Output: 0 1 ip
  160. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 1 [n,i] Output: 0 1 ip
  161. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 2 [n,i] Output: 0 1 ip
  162. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 2 1 [n,i] Output: 0 1 ip
  163. 31 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 2 1 0 [n,i] Output: 0 1 ip
  164. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 ip
  165. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 [n,i] Output: 0 1 ip
  166. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 1 0 [n,i] Output: 0 1 ip
  167. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 2 [n,i] Output: 0 1 ip
  168. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 ip
  169. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 ip
  170. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 32 [n,i] Output: 0 1 2 ip
  171. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 ip
  172. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 ip
  173. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 ip
  174. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 2 [n,i] Output: 0 1 2 ip
  175. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 ip
  176. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 ip
  177. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 ip
  178. 32 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 [n,i] Output: 0 1 2 ip
  179. 33 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 3 ip
  180. 33 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 3 ip
  181. 33 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 3 ip
  182. 33 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ 3 3 [n,i] Output: 0 1 2 3 ip
  183. 33 @ > & 00p 0 10p ;; 0. ;;

    " ", ;; > 00g 10g w @ v < > 10g 1+ 10p ;; 10g. ;; " ", ^ [n,i] Output: 0 1 2 3 ip
  184. int sp = 0; double val[MAXVAL]; void push(double f) {

    val[sp++] = f; } double pop(void) { return val[--sp]; }
  185. /* reverse Polish calculator */ int main(int argc, char **argv)

    { int type; double op2; char s[MAXOP]; while ((type = getop(s)) != EOF) { switch (type) { case NUMBER: push(atof(s)); break; case '+': push (pop() + pop()) ; break; case '*': push(pop() * pop()); break; case '-': op2 = pop(); push(pop() - op2); break; case '/': op2 = pop(); if (op2 != 0.0) push(pop() / op2); else printf("error: zero divisor\n"); break; case '\n': printf("\t%.8g\n", pop()); break; default: printf("error: unknown command %s\n", s); break; } } return 0; }