3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP if (!class_exists('RuntimeException')) { class RuntimeException extends Exception { } } class InvalidStateException extends RuntimeException { } class Compiler { private $ptr; private $arr; private $code; private $commands = array('>', '<', '+', '-', '.', ',', '[', ']'); private $call_stack = array(); private $cellsize = 8; public function parseString($code, $throwException = true) { $this->code = $code; for ($i=0;$i<strlen($this->code);$i++) { $c = substr($this->code, $i, 1); if (!in_array($c, $this->commands)) { continue; } } } public function execute($code) { $this->arr = array(0 => 0); $this->ptr = 0; $this->code = $code; $jump = -1; $loop = array(); $depth = 0; for ($this->i=0;$this->i<strlen($this->code);$this->i++) { $c = $this->c = substr($this->code, $this->i, 1); $cell = $this->arr[$this->ptr]; if (!in_array($c, $this->commands)) { continue; } else if ($jump >= 0) { if ($c == '[') { $depth++; } if ($c == ']') { if ($depth === $jump) { $jump = -1; $this->stack(); } $depth--; } } else { if ($c == '>') { $this->increment_pointer(); } elseif ($c == '<') { $this->decrement_pointer(); } elseif ($c == '+') { $this->increment_val(); } elseif ($c == '-') { $this->decrement_val(); } elseif ($c == '.') { $this->output_val(); } elseif ($c == ',') { $this->store_val($this->input_val()); } elseif ($c == '[') { $depth++; if ($cell == 0) { $this->stack('jump'); $jump = $depth; } else { array_push($loop, $this->i); } } elseif ($c == ']') { if ($cell > 0) { $this->i = $loop[count($loop)-1]; continue; } else { array_pop($loop); $depth--; continue; } } } } } private function stack($func=null) { if (is_null($func)) { if (count($this->call_stack) == 0) { throw new InvalidStateException("Trying to pop empty call stack"); return false; } array_pop($this->call_stack); return true; } else { $info = array('command' => $this->c, 'pos' => $this->i, 'internal_function' => $func); array_push($this->call_stack, $info); echo 'Stacking '.$func.PHP_EOL; return true; } } public function minimum_cellsize() { return (-1*(pow(2, $this->cellsize-1))); } public function maximum_cellsize() { return pow(2, $this->cellsize-1)-1; } private function increment_pointer() { $this->stack(__FUNCTION__); $this->ptr++; if (!isset($this->arr[$this->ptr])) $this->arr[$this->ptr] = 0; $this->stack(); return true; } private function decrement_pointer() { $this->stack(__FUNCTION__); $this->ptr--; if ($this->ptr < 0) { throw new InvalidStateException("The data pointer is less than 0"); return false; } $this->stack(); return true; } private function increment_val() { $x = $this->arr[$this->ptr]++; if ($x < $this->minimum_cellsize()) { $this->arr[$this->ptr] = $this->maximum_cellsize(); } elseif ($x > $this->maximum_cellsize()) { $this->arr[$this->ptr] = $this->minimum_cellsize(); } return true; } private function decrement_val() { $x = $this->arr[$this->ptr]--; if ($x < $this->minimum_cellsize()) { $this->arr[$this->ptr] = $this->maximum_cellsize(); } elseif ($x > $this->maximum_cellsize()) { $this->arr[$this->ptr] = $this->minimum_cellsize(); } return true; } private function output_val() { $c = $this->arr[$this->ptr]; echo ''.chr($c); } private function store_val($chr) { $x = ord($chr); $this->arr[$this->ptr] = $x; } private function input_val() { return fgets(STDIN); } public function getCallStack() { return $this->call_stack; } public function getCells() { return $this->arr; } public function getPointer() { return $this->ptr; } } $c = new Compiler(); $bf = ' +++++++++++ >+>>>>++++++++++++++++++++++++++++++++++++++++++++ >++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+> +<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[- <-[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<[>>>+<<< -]>>[-]]<<]>>>[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]] >[<<+>>[-]]<<<<<<<]>>>>>[+++++++++++++++++++++++++ +++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++ ++++++++++++++++++++++++++++++++++++++++++++.[-]<< <<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<< [-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-] '; try { $c->execute($bf); } catch (Exception $e) { echo PHP_EOL."An exception was thrown whilst processing your BF program.".PHP_EOL; echo $e->getMessage().":".PHP_EOL; } echo "The pointer was set to ".$c->getPointer()." and the cell array resembled:".PHP_EOL; echo "[".implode(", ", $c->getCells())."]".PHP_EOL; echo "The current stack trace was:".PHP_EOL; foreach ($c->getCallStack() as $k => $call) { echo '#'.$k.' '.$call['command'].' ('.$call['internal_function'],') on pos '.$call['pos'].PHP_EOL; } echo PHP_EOL.'Finished.'.PHP_EOL; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 41, Position 2 = 56
Branch analysis from position: 41
2 jumps found. (Code = 78) Position 1 = 42, Position 2 = 56
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
Branch analysis from position: 6
Found catch point at position: 14
Branch analysis from position: 14
2 jumps found. (Code = 107) Position 1 = 15, Position 2 = -2
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 41, Position 2 = 56
Branch analysis from position: 41
Branch analysis from position: 56
filename:       /in/fVUEB
function name:  (null)
number of ops:  59
compiled vars:  !0 = $c, !1 = $bf, !2 = $e, !3 = $call, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'class_exists'
          1        SEND_VAL                                                 'RuntimeException'
          2        DO_ICALL                                         $5      
          3        BOOL_NOT                                         ~6      $5
          4      > JMPZ                                                     ~6, ->6
    4     5    >   DECLARE_CLASS                                            'runtimeexception', 'exception'
  189     6    >   NEW                                              $7      'Compiler'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !0, $7
  191     9        ASSIGN                                                   !1, '%0A%0A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%0A%3E%2B%3E%3E%3E%3E%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%0A%3E%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%3C%3C%3C%3C%3C%3C%5B%3E%5B%3E%3E%3E%3E%3E%3E%2B%3E%0A%2B%3C%3C%3C%3C%3C%3C%3C-%5D%3E%3E%3E%3E%3E%3E%3E%5B%3C%3C%3C%3C%3C%3C%3C%2B%3E%3E%3E%3E%3E%3E%3E-%5D%3C%5B%3E%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%5B-%0A%3C-%5B%3E%3E%2B%3E%2B%3C%3C%3C-%5D%3E%3E%3E%5B%3C%3C%3C%2B%3E%3E%3E-%5D%2B%3C%5B%3E%5B-%5D%3C%5B-%5D%5D%3E%5B%3C%3C%5B%3E%3E%3E%2B%3C%3C%3C%0A-%5D%3E%3E%5B-%5D%5D%3C%3C%5D%3E%3E%3E%5B%3E%3E%2B%3E%2B%3C%3C%3C-%5D%3E%3E%3E%5B%3C%3C%3C%2B%3E%3E%3E-%5D%2B%3C%5B%3E%5B-%5D%3C%5B-%5D%5D%0A%3E%5B%3C%3C%2B%3E%3E%5B-%5D%5D%3C%3C%3C%3C%3C%3C%3C%5D%3E%3E%3E%3E%3E%5B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%0A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B.%5B-%5D%5D%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%3C%5B-%3E-%3C%5D%3E%2B%2B%2B%2B%0A%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B%2B.%5B-%5D%3C%3C%0A%3C%3C%3C%3C%3C%3C%3C%3C%3C%3C%5B%3E%3E%3E%2B%3E%2B%3C%3C%3C%3C-%5D%3E%3E%3E%3E%5B%3C%3C%3C%3C%2B%3E%3E%3E%3E-%5D%3C-%5B%3E%3E.%3E.%3C%3C%3C%0A%5B-%5D%5D%3C%3C%5B%3E%3E%2B%3E%2B%3C%3C%3C-%5D%3E%3E%3E%5B%3C%3C%3C%2B%3E%3E%3E-%5D%3C%3C%5B%3C%2B%3E-%5D%3E%5B%3C%2B%3E-%5D%3C%3C%3C-%5D%0A%0A'
  208    10        INIT_METHOD_CALL                                         !0, 'execute'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
         13      > JMP                                                      ->21
  210    14  E > > CATCH                                       last         'Exception'
  211    15    >   ECHO                                                     '%0AAn+exception+was+thrown+whilst+processing+your+BF+program.%0A'
  212    16        INIT_METHOD_CALL                                         !2, 'getMessage'
         17        DO_FCALL                                      0  $12     
         18        CONCAT                                           ~13     $12, '%3A'
         19        CONCAT                                           ~14     ~13, '%0A'
         20        ECHO                                                     ~14
  214    21    >   INIT_METHOD_CALL                                         !0, 'getPointer'
         22        DO_FCALL                                      0  $15     
         23        CONCAT                                           ~16     'The+pointer+was+set+to+', $15
         24        CONCAT                                           ~17     ~16, '+and+the+cell+array+resembled%3A'
         25        CONCAT                                           ~18     ~17, '%0A'
         26        ECHO                                                     ~18
  215    27        INIT_FCALL                                               'implode'
         28        SEND_VAL                                                 '%2C+'
         29        INIT_METHOD_CALL                                         !0, 'getCells'
         30        DO_FCALL                                      0  $19     
         31        SEND_VAR                                                 $19
         32        DO_ICALL                                         $20     
         33        CONCAT                                           ~21     '%5B', $20
         34        CONCAT                                           ~22     ~21, '%5D'
         35        CONCAT                                           ~23     ~22, '%0A'
         36        ECHO                                                     ~23
  216    37        ECHO                                                     'The+current+stack+trace+was%3A%0A'
  217    38        INIT_METHOD_CALL                                         !0, 'getCallStack'
         39        DO_FCALL                                      0  $24     
         40      > FE_RESET_R                                       $25     $24, ->56
         41    > > FE_FETCH_R                                       ~26     $25, !3, ->56
         42    >   ASSIGN                                                   !4, ~26
  218    43        CONCAT                                           ~28     '%23', !4
         44        CONCAT                                           ~29     ~28, '+'
         45        FETCH_DIM_R                                      ~30     !3, 'command'
         46        CONCAT                                           ~31     ~29, ~30
         47        CONCAT                                           ~32     ~31, '+%28'
         48        FETCH_DIM_R                                      ~33     !3, 'internal_function'
         49        CONCAT                                           ~34     ~32, ~33
         50        ECHO                                                     ~34
         51        FETCH_DIM_R                                      ~35     !3, 'pos'
         52        CONCAT                                           ~36     '%29+on+pos+', ~35
         53        CONCAT                                           ~37     ~36, '%0A'
         54        ECHO                                                     ~37
  217    55      > JMP                                                      ->41
         56    >   FE_FREE                                                  $25
  220    57        ECHO                                                     '%0AFinished.%0A'
  221    58      > RETURN                                                   1

Class RuntimeException: [no user functions]
Class InvalidStateException: [no user functions]
Class Compiler:
Function parsestring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 6
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 6
Branch analysis from position: 26
Branch analysis from position: 6
Branch analysis from position: 21
filename:       /in/fVUEB
function name:  parseString
number of ops:  27
compiled vars:  !0 = $code, !1 = $throwException, !2 = $i, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <true>
   17     2        ASSIGN_OBJ                                               'code'
          3        OP_DATA                                                  !0
   18     4        ASSIGN                                                   !2, 0
          5      > JMP                                                      ->22
   19     6    >   INIT_FCALL                                               'substr'
          7        FETCH_OBJ_R                                      ~6      'code'
          8        SEND_VAL                                                 ~6
          9        SEND_VAR                                                 !2
         10        SEND_VAL                                                 1
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !3, $7
   20    13        INIT_FCALL                                               'in_array'
         14        SEND_VAR                                                 !3
         15        FETCH_OBJ_R                                      ~9      'commands'
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                         $10     
         18        BOOL_NOT                                         ~11     $10
         19      > JMPZ                                                     ~11, ->21
   21    20    > > JMP                                                      ->21
   18    21    >   PRE_INC                                                  !2
         22    >   FETCH_OBJ_R                                      ~13     'code'
         23        STRLEN                                           ~14     ~13
         24        IS_SMALLER                                               !2, ~14
         25      > JMPNZ                                                    ~15, ->6
   24    26    > > RETURN                                                   null

End of function parsestring

Function execute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 116
Branch analysis from position: 116
2 jumps found. (Code = 44) Position 1 = 121, Position 2 = 13
Branch analysis from position: 121
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
2 jumps found. (Code = 44) Position 1 = 121, Position 2 = 13
Branch analysis from position: 121
Branch analysis from position: 13
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 50
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 41
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 49
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 48
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 48
Branch analysis from position: 49
Branch analysis from position: 41
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 55
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 60
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 62, Position 2 = 65
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 70
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 75
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 83
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 83
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 99
Branch analysis from position: 85
2 jumps found. (Code = 43) Position 1 = 88, Position 2 = 93
Branch analysis from position: 88
1 jumps found. (Code = 42) Position 1 = 98
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 99
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 115
Branch analysis from position: 101
2 jumps found. (Code = 43) Position 1 = 103, Position 2 = 110
Branch analysis from position: 103
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 110
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
Branch analysis from position: 115
filename:       /in/fVUEB
function name:  execute
number of ops:  122
compiled vars:  !0 = $code, !1 = $jump, !2 = $loop, !3 = $depth, !4 = $c, !5 = $cell
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   27     1        ASSIGN_OBJ                                               'arr'
          2        OP_DATA                                                  <array>
   28     3        ASSIGN_OBJ                                               'ptr'
          4        OP_DATA                                                  0
   29     5        ASSIGN_OBJ                                               'code'
          6        OP_DATA                                                  !0
   30     7        ASSIGN                                                   !1, -1
   31     8        ASSIGN                                                   !2, <array>
   32     9        ASSIGN                                                   !3, 0
   34    10        ASSIGN_OBJ                                               'i'
         11        OP_DATA                                                  0
         12      > JMP                                                      ->116
   35    13    >   INIT_FCALL                                               'substr'
         14        FETCH_OBJ_R                                      ~14     'code'
         15        SEND_VAL                                                 ~14
         16        FETCH_OBJ_R                                      ~15     'i'
         17        SEND_VAL                                                 ~15
         18        SEND_VAL                                                 1
         19        DO_ICALL                                         $16     
         20        ASSIGN_OBJ                                       ~13     'c'
         21        OP_DATA                                                  $16
         22        ASSIGN                                                   !4, ~13
   36    23        FETCH_OBJ_R                                      ~19     'ptr'
         24        FETCH_OBJ_R                                      ~18     'arr'
         25        FETCH_DIM_R                                      ~20     ~18, ~19
         26        ASSIGN                                                   !5, ~20
   37    27        INIT_FCALL                                               'in_array'
         28        SEND_VAR                                                 !4
         29        FETCH_OBJ_R                                      ~22     'commands'
         30        SEND_VAL                                                 ~22
         31        DO_ICALL                                         $23     
         32        BOOL_NOT                                         ~24     $23
         33      > JMPZ                                                     ~24, ->36
   38    34    > > JMP                                                      ->115
         35*       JMP                                                      ->115
   40    36    >   IS_SMALLER_OR_EQUAL                                      0, !1
         37      > JMPZ                                                     ~25, ->50
   41    38    >   IS_EQUAL                                                 !4, '%5B'
         39      > JMPZ                                                     ~26, ->41
   42    40    >   PRE_INC                                                  !3
   44    41    >   IS_EQUAL                                                 !4, '%5D'
         42      > JMPZ                                                     ~28, ->49
   45    43    >   IS_IDENTICAL                                             !3, !1
         44      > JMPZ                                                     ~29, ->48
   46    45    >   ASSIGN                                                   !1, -1
   47    46        INIT_METHOD_CALL                                         'stack'
         47        DO_FCALL                                      0          
   49    48    >   PRE_DEC                                                  !3
         49    > > JMP                                                      ->115
   53    50    >   IS_EQUAL                                                 !4, '%3E'
         51      > JMPZ                                                     ~33, ->55
   54    52    >   INIT_METHOD_CALL                                         'increment_pointer'
         53        DO_FCALL                                      0          
         54      > JMP                                                      ->115
   56    55    >   IS_EQUAL                                                 !4, '%3C'
         56      > JMPZ                                                     ~35, ->60
   57    57    >   INIT_METHOD_CALL                                         'decrement_pointer'
         58        DO_FCALL                                      0          
         59      > JMP                                                      ->115
   59    60    >   IS_EQUAL                                                 !4, '%2B'
         61      > JMPZ                                                     ~37, ->65
   60    62    >   INIT_METHOD_CALL                                         'increment_val'
         63        DO_FCALL                                      0          
         64      > JMP                                                      ->115
   62    65    >   IS_EQUAL                                                 !4, '-'
         66      > JMPZ                                                     ~39, ->70
   63    67    >   INIT_METHOD_CALL                                         'decrement_val'
         68        DO_FCALL                                      0          
         69      > JMP                                                      ->115
   65    70    >   IS_EQUAL                                                 !4, '.'
         71      > JMPZ                                                     ~41, ->75
   66    72    >   INIT_METHOD_CALL                                         'output_val'
         73        DO_FCALL                                      0          
         74      > JMP                                                      ->115
   68    75    >   IS_EQUAL                                                 !4, '%2C'
         76      > JMPZ                                                     ~43, ->83
   69    77    >   INIT_METHOD_CALL                                         'store_val'
         78        INIT_METHOD_CALL                                         'input_val'
         79        DO_FCALL                                      0  $44     
         80        SEND_VAR_NO_REF_EX                                       $44
         81        DO_FCALL                                      0          
         82      > JMP                                                      ->115
   71    83    >   IS_EQUAL                                                 !4, '%5B'
         84      > JMPZ                                                     ~46, ->99
   72    85    >   PRE_INC                                                  !3
   73    86        IS_EQUAL                                                 !5, 0
         87      > JMPZ                                                     ~48, ->93
   74    88    >   INIT_METHOD_CALL                                         'stack'
         89        SEND_VAL_EX                                              'jump'
         90        DO_FCALL                                      0          
   75    91        ASSIGN                                                   !1, !3
         92      > JMP                                                      ->98
   78    93    >   INIT_FCALL                                               'array_push'
         94        SEND_REF                                                 !2
         95        FETCH_OBJ_R                                      ~51     'i'
         96        SEND_VAL                                                 ~51
         97        DO_ICALL                                                 
         98    > > JMP                                                      ->115
   81    99    >   IS_EQUAL                                                 !4, '%5D'
        100      > JMPZ                                                     ~53, ->115
   82   101    >   IS_SMALLER                                               0, !5
        102      > JMPZ                                                     ~54, ->110
   83   103    >   COUNT                                            ~56     !2
        104        SUB                                              ~57     ~56, 1
        105        FETCH_DIM_R                                      ~58     !2, ~57
        106        ASSIGN_OBJ                                               'i'
        107        OP_DATA                                                  ~58
   84   108      > JMP                                                      ->115
        109*       JMP                                                      ->115
   87   110    >   INIT_FCALL                                               'array_pop'
        111        SEND_REF                                                 !2
        112        DO_ICALL                                                 
   88   113        PRE_DEC                                                  !3
   89   114      > JMP                                                      ->115
   34   115    >   PRE_INC_OBJ                                              'i'
        116    >   FETCH_OBJ_R                                      ~62     'i'
        117        FETCH_OBJ_R                                      ~63     'code'
        118        STRLEN                                           ~64     ~63
        119        IS_SMALLER                                               ~62, ~64
        120      > JMPNZ                                                    ~65, ->13
   94   121    > > RETURN                                                   null

End of function execute

Function stack:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fVUEB
function name:  stack
number of ops:  34
compiled vars:  !0 = $func, !1 = $info
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   96     0  E >   RECV_INIT                                        !0      null
   97     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~2, ->18
   98     3    >   FETCH_OBJ_R                                      ~3      'call_stack'
          4        COUNT                                            ~4      ~3
          5        IS_EQUAL                                                 ~4, 0
          6      > JMPZ                                                     ~5, ->12
   99     7    >   NEW                                              $6      'InvalidStateException'
          8        SEND_VAL_EX                                              'Trying+to+pop+empty+call+stack'
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $6
  100    11*       RETURN                                                   <false>
  102    12    >   INIT_FCALL                                               'array_pop'
         13        FETCH_OBJ_W                                      $8      'call_stack'
         14        SEND_REF                                                 $8
         15        DO_ICALL                                                 
  103    16      > RETURN                                                   <true>
         17*       JMP                                                      ->33
  106    18    >   FETCH_OBJ_R                                      ~10     'c'
         19        INIT_ARRAY                                       ~11     ~10, 'command'
         20        FETCH_OBJ_R                                      ~12     'i'
         21        ADD_ARRAY_ELEMENT                                ~11     ~12, 'pos'
         22        ADD_ARRAY_ELEMENT                                ~11     !0, 'internal_function'
         23        ASSIGN                                                   !1, ~11
  107    24        INIT_FCALL                                               'array_push'
         25        FETCH_OBJ_W                                      $14     'call_stack'
         26        SEND_REF                                                 $14
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
  108    29        CONCAT                                           ~16     'Stacking+', !0
         30        CONCAT                                           ~17     ~16, '%0A'
         31        ECHO                                                     ~17
  109    32      > RETURN                                                   <true>
  111    33*     > RETURN                                                   null

End of function stack

Function minimum_cellsize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fVUEB
function name:  minimum_cellsize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  114     0  E >   INIT_FCALL                                               'pow'
          1        SEND_VAL                                                 2
          2        FETCH_OBJ_R                                      ~0      'cellsize'
          3        SUB                                              ~1      ~0, 1
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                         $2      
          6        MUL                                              ~3      $2, -1
          7      > RETURN                                                   ~3
  115     8*     > RETURN                                                   null

End of function minimum_cellsize

Function maximum_cellsize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fVUEB
function name:  maximum_cellsize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  118     0  E >   INIT_FCALL                                               'pow'
          1        SEND_VAL                                                 2
          2        FETCH_OBJ_R                                      ~0      'cellsize'
          3        SUB                                              ~1      ~0, 1
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                         $2      
          6        SUB                                              ~3      $2, 1
          7      > RETURN                                                   ~3
  119     8*     > RETURN                                                   null

End of function maximum_cellsize

Function increment_pointer:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/fVUEB
function name:  increment_pointer
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  122     0  E >   INIT_METHOD_CALL                                         'stack'
          1        SEND_VAL                                                 'increment_pointer'
          2        DO_FCALL                                      0          
  123     3        PRE_INC_OBJ                                              'ptr'
  124     4        FETCH_OBJ_R                                      ~3      'ptr'
          5        FETCH_OBJ_IS                                     ~2      'arr'
          6        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      ~2, ~3
          7        BOOL_NOT                                         ~5      ~4
          8      > JMPZ                                                     ~5, ->13
          9    >   FETCH_OBJ_R                                      ~7      'ptr'
         10        FETCH_OBJ_W                                      $6      'arr'
         11        ASSIGN_DIM                                               $6, ~7
         12        OP_DATA                                                  0
  125    13    >   INIT_METHOD_CALL                                         'stack'
         14        DO_FCALL                                      0          
  126    15      > RETURN              

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
274.23 ms | 1428 KiB | 28 Q