fork download
  1. LABEL prev,next;
  2. var
  3. data_mem: array[1..10] of integer;
  4. command_mem: string;
  5. i,j,k: integer;
  6. i_stor: integer;
  7. begin
  8. j:=1;
  9. i:=1;
  10. readln(command_mem);
  11. prev:
  12. if i>length(command_mem) then goto next;
  13. if (command_mem[i]='+') then data_mem[j]:= data_mem[j]+1;
  14. if (command_mem[i]='-') then data_mem[j]:= data_mem[j]-1;
  15. if (command_mem[i]='>') then j:=j+1;
  16. if (command_mem[i]='<') then j:=j-1;
  17. if (command_mem[i]='.') then write(chr(data_mem[j]));
  18. if (command_mem[i]='[') then
  19. begin
  20. if data_mem[j]>0 then i_stor:=i;
  21. end;
  22. if (command_mem[i]=']') then
  23. begin
  24. if data_mem[j]>0 then
  25. begin
  26. i:=i_stor;
  27. end;
  28. end;
  29.  
  30. i:=i+1;
  31. goto prev;
  32. next:
  33. for k:=1 to 10 do begin
  34. write(data_mem[k]);
  35. write(' ');
  36. end;
  37. end.
Success #stdin #stdout 0s 9128KB
stdin
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
stdout
Hello World!
0 87 100 33 10 0 0 0 0 0