3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); namespace AzJezz\BrainFuck; use ArrayIterator; use Iterator; use RuntimeException; final class MemoryCell { public $value = 0; public function increase(): void { ++$this->value; if (256 === $this->value) { $this->value = 0; } } public function decrease(): void { --$this->value; if (-1 === $this->value) { $this->value = 255; } } } final class MemoryTable { private $position = 0; private $cells = []; public function current(): MemoryCell { $this->cells[$this->position] = $this->cells[$this->position] ?? new MemoryCell(); return $this->cells[$this->position]; } public function right(): void { ++$this->position; } public function left(): void { --$this->position; } public function free(): void { $this->position = 0; $this->cells = []; } } final class Token { public const Right = 0; public const Left = 2; public const Read = 4; public const Write = 8; public const Increase = 16; public const Decrease = 32; public const LoopIn = 64; public const LoopOut = 128; private const tokens = [ 'right' => Token::Right, // > 'left' => Token::Left, // < 'read' => Token::Read, // . 'write' => Token::Write, // , 'increase' => Token::Increase, // + 'decrease' => Token::Decrease, // - 'loop-in' => Token::LoopIn, // [ 'loop-out' => Token::LoopOut, // ] ]; private $token; public function __construct(string $token) { $this->token = static::tokens[$token]; } public function kind(): int { return $this->token; } } final class Lexer { public function tokenize(string $code): Iterator { foreach (str_split($code) as $i => $chr) { switch ($chr) { case '>': yield $i => new Token('right'); break; case '<': yield $i => new Token('left'); break; case '.': yield $i => new Token('write'); break; case ',': yield $i => new Token('read'); break; case '+': yield $i => new Token('increase'); break; case '-': yield $i => new Token('decrease'); break; case '[': yield $i => new Token('loop-in'); break; case ']': yield $i => new Token('loop-out'); break; } } } } final class Interpreter { private $lexer; private $table; private $stdin; private $stdout; /** * Interpreter constructor. * * @param resource $stdin * @param resource $stdout */ public function __construct(Lexer $lexer, $stdin, $stdout) { $this->lexer = $lexer; $this->stdin = $stdin; $this->stdout = $stdout; $this->table = new MemoryTable(); } public function run(string $code): void { $this->table->free(); $tokens = $this->lexer->tokenize($code); $this->process($tokens); } public function read(): void { do { $this->table->current()->value = ord(fread($this->stdin, 1)); } while ($this->table->current()->value > 255); } public function write(): void { fwrite($this->stdout, chr($this->table->current()->value)); } private function process(Iterator $tokens): void { while ($tokens->valid()) { /** * @var Token */ $token = $tokens->current(); if (Token::LoopIn === $token->kind()) { $inner = []; $tokens->next(); $nest = 1; while ($tokens->valid()) { $current = $tokens->current(); $inner[$tokens->key()] = $current; if (Token::LoopOut === $current->kind()) { --$nest; } elseif (Token::LoopIn === $current->kind()) { ++$nest; } $tokens->next(); if (0 === $nest) { break; } } assert(0 === $nest); array_pop($inner); while (0 !== $this->table->current()->value) { $this->process(new ArrayIterator($inner)); } continue; } if (Token::LoopOut === $token->kind()) { throw new RuntimeException('Unexpected "]" token.'); } $this->operate($token); $tokens->next(); } } private function operate(Token $token): void { switch ($token->kind()) { case Token::Right: $this->table->right(); break; case Token::Left: $this->table->left(); break; case Token::Increase: $this->table->current()->increase(); break; case Token::Decrease: $this->table->current()->decrease(); break; case Token::Read: $this->read(); break; case Token::Write: $this->write(); break; } } } $interpreter = new Interpreter(new Lexer(), STDIN, STDOUT); $interpreter->run('+[-[<<[+[--->]-[<<<]]]>>>-]>-.---.>..>.<<<<-.<+.>>>>>.>.<<.<-.'); // hello world
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  (null)
number of ops:  14
compiled vars:  !0 = $interpreter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  261     0  E >   NEW                                              $1      'AzJezz%5CBrainFuck%5CInterpreter'
          1        NEW                                              $2      'AzJezz%5CBrainFuck%5CLexer'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        FETCH_CONSTANT                                   ~4      'AzJezz%5CBrainFuck%5CSTDIN'
          5        SEND_VAL_EX                                              ~4
          6        FETCH_CONSTANT                                   ~5      'AzJezz%5CBrainFuck%5CSTDOUT'
          7        SEND_VAL_EX                                              ~5
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !0, $1
  263    10        INIT_METHOD_CALL                                         !0, 'run'
         11        SEND_VAL_EX                                              '%2B%5B-%5B%3C%3C%5B%2B%5B---%3E%5D-%5B%3C%3C%3C%5D%5D%5D%3E%3E%3E-%5D%3E-.---.%3E..%3E.%3C%3C%3C%3C-.%3C%2B.%3E%3E%3E%3E%3E.%3E.%3C%3C.%3C-.'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Class AzJezz\BrainFuck\MemoryCell:
Function increase:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/9lEte
function name:  increase
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   PRE_INC_OBJ                                              'value'
   19     1        FETCH_OBJ_R                                      ~1      'value'
          2        IS_IDENTICAL                                             ~1, 256
          3      > JMPZ                                                     ~2, ->6
   20     4    >   ASSIGN_OBJ                                               'value'
          5        OP_DATA                                                  0
   22     6    > > RETURN                                                   null

End of function increase

Function decrease:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/9lEte
function name:  decrease
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   PRE_DEC_OBJ                                              'value'
   28     1        FETCH_OBJ_R                                      ~1      'value'
          2        IS_IDENTICAL                                             ~1, -1
          3      > JMPZ                                                     ~2, ->6
   29     4    >   ASSIGN_OBJ                                               'value'
          5        OP_DATA                                                  255
   31     6    > > RETURN                                                   null

End of function decrease

End of class AzJezz\BrainFuck\MemoryCell.

Class AzJezz\BrainFuck\MemoryTable:
Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  current
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   FETCH_OBJ_R                                      ~1      'position'
          1        FETCH_OBJ_R                                      ~4      'position'
          2        FETCH_OBJ_IS                                     ~3      'cells'
          3        FETCH_DIM_IS                                     ~5      ~3, ~4
          4        COALESCE                                         ~6      ~5
          5        NEW                                              $7      'AzJezz%5CBrainFuck%5CMemoryCell'
          6        DO_FCALL                                      0          
          7        QM_ASSIGN                                        ~6      $7
          8        FETCH_OBJ_W                                      $0      'cells'
          9        ASSIGN_DIM                                               $0, ~1
         10        OP_DATA                                                  ~6
   44    11        FETCH_OBJ_R                                      ~10     'position'
         12        FETCH_OBJ_R                                      ~9      'cells'
         13        FETCH_DIM_R                                      ~11     ~9, ~10
         14        VERIFY_RETURN_TYPE                                       ~11
         15      > RETURN                                                   ~11
   45    16*       VERIFY_RETURN_TYPE                                       
         17*     > RETURN                                                   null

End of function current

Function right:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  right
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   PRE_INC_OBJ                                              'position'
   50     1      > RETURN                                                   null

End of function right

Function left:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  left
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   54     0  E >   PRE_DEC_OBJ                                              'position'
   55     1      > RETURN                                                   null

End of function left

Function free:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  free
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   59     0  E >   ASSIGN_OBJ                                               'position'
          1        OP_DATA                                                  0
   60     2        ASSIGN_OBJ                                               'cells'
          3        OP_DATA                                                  <array>
   61     4      > RETURN                                                   null

End of function free

End of class AzJezz\BrainFuck\MemoryTable.

Class AzJezz\BrainFuck\Token:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  __construct
number of ops:  6
compiled vars:  !0 = $token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   95     0  E >   RECV                                             !0      
   97     1        FETCH_CLASS_CONSTANT                             ~2      'tokens'
          2        FETCH_DIM_R                                      ~3      ~2, !0
          3        ASSIGN_OBJ                                               'token'
          4        OP_DATA                                                  ~3
   98     5      > RETURN                                                   null

End of function __construct

Function kind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  kind
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  102     0  E >   FETCH_OBJ_R                                      ~0      'token'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
  103     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function kind

End of class AzJezz\BrainFuck\Token.

Class AzJezz\BrainFuck\Lexer:
Function tokenize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 67
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 67
Branch analysis from position: 7
10 jumps found. (Code = 188) Position 1 = 26, Position 2 = 31, Position 3 = 36, Position 4 = 41, Position 5 = 46, Position 6 = 51, Position 7 = 56, Position 8 = 61, Position 9 = 66, Position 10 = 9
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 66
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 26
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 31
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 36
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 41
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 46
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 51
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 56
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 61
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
Branch analysis from position: 61
Branch analysis from position: 56
Branch analysis from position: 51
Branch analysis from position: 46
Branch analysis from position: 41
Branch analysis from position: 36
Branch analysis from position: 31
Branch analysis from position: 26
Branch analysis from position: 67
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 67
filename:       /in/9lEte
function name:  tokenize
number of ops:  69
compiled vars:  !0 = $code, !1 = $chr, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  108     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
  110     2        INIT_NS_FCALL_BY_NAME                                    'AzJezz%5CBrainFuck%5Cstr_split'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $3      
          5      > FE_RESET_R                                       $4      $3, ->67
          6    > > FE_FETCH_R                                       ~5      $4, !1, ->67
          7    >   ASSIGN                                                   !2, ~5
  111     8      > SWITCH_STRING                                            !1, [ '%3E':->26, '%3C':->31, '.':->36, '%2C':->41, '%2B':->46, '-':->51, '%5B':->56, '%5D':->61, ], ->66
  112     9    >   IS_EQUAL                                                 !1, '%3E'
         10      > JMPNZ                                                    ~7, ->26
  115    11    >   IS_EQUAL                                                 !1, '%3C'
         12      > JMPNZ                                                    ~7, ->31
  118    13    >   IS_EQUAL                                                 !1, '.'
         14      > JMPNZ                                                    ~7, ->36
  121    15    >   IS_EQUAL                                                 !1, '%2C'
         16      > JMPNZ                                                    ~7, ->41
  124    17    >   IS_EQUAL                                                 !1, '%2B'
         18      > JMPNZ                                                    ~7, ->46
  127    19    >   IS_EQUAL                                                 !1, '-'
         20      > JMPNZ                                                    ~7, ->51
  130    21    >   IS_EQUAL                                                 !1, '%5B'
         22      > JMPNZ                                                    ~7, ->56
  133    23    >   IS_EQUAL                                                 !1, '%5D'
         24      > JMPNZ                                                    ~7, ->61
         25    > > JMP                                                      ->66
  113    26    >   NEW                                              $8      'AzJezz%5CBrainFuck%5CToken'
         27        SEND_VAL_EX                                              'right'
         28        DO_FCALL                                      0          
         29        YIELD                                                    $8, !2
  114    30      > JMP                                                      ->66
  116    31    >   NEW                                              $11     'AzJezz%5CBrainFuck%5CToken'
         32        SEND_VAL_EX                                              'left'
         33        DO_FCALL                                      0          
         34        YIELD                                                    $11, !2
  117    35      > JMP                                                      ->66
  119    36    >   NEW                                              $14     'AzJezz%5CBrainFuck%5CToken'
         37        SEND_VAL_EX                                              'write'
         38        DO_FCALL                                      0          
         39        YIELD                                                    $14, !2
  120    40      > JMP                                                      ->66
  122    41    >   NEW                                              $17     'AzJezz%5CBrainFuck%5CToken'
         42        SEND_VAL_EX                                              'read'
         43        DO_FCALL                                      0          
         44        YIELD                                                    $17, !2
  123    45      > JMP                                                      ->66
  125    46    >   NEW                                              $20     'AzJezz%5CBrainFuck%5CToken'
         47        SEND_VAL_EX                                              'increase'
         48        DO_FCALL                                      0          
         49        YIELD                                                    $20, !2
  126    50      > JMP                                                      ->66
  128    51    >   NEW                                              $23     'AzJezz%5CBrainFuck%5CToken'
         52        SEND_VAL_EX                                              'decrease'
         53        DO_FCALL                                      0          
         54        YIELD                                                    $23, !2
  129    55      > JMP                                                      ->66
  131    56    >   NEW                                              $26     'AzJezz%5CBrainFuck%5CToken'
         57        SEND_VAL_EX                                              'loop-in'
         58        DO_FCALL                                      0          
         59        YIELD                                                    $26, !2
  132    60      > JMP                                                      ->66
  134    61    >   NEW                                              $29     'AzJezz%5CBrainFuck%5CToken'
         62        SEND_VAL_EX                                              'loop-out'
         63        DO_FCALL                                      0          
         64        YIELD                                                    $29, !2
  135    65      > JMP                                                      ->66
  110    66    > > JMP                                                      ->6
         67    >   FE_FREE                                                  $4
  138    68      > GENERATOR_RETURN                                         

End of function tokenize

End of class AzJezz\BrainFuck\Lexer.

Class AzJezz\BrainFuck\Interpreter:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  __construct
number of ops:  14
compiled vars:  !0 = $lexer, !1 = $stdin, !2 = $stdout
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  157     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  159     3        ASSIGN_OBJ                                               'lexer'
          4        OP_DATA                                                  !0
  160     5        ASSIGN_OBJ                                               'stdin'
          6        OP_DATA                                                  !1
  161     7        ASSIGN_OBJ                                               'stdout'
          8        OP_DATA                                                  !2
  162     9        NEW                                              $7      'AzJezz%5CBrainFuck%5CMemoryTable'
         10        DO_FCALL                                      0          
         11        ASSIGN_OBJ                                               'table'
         12        OP_DATA                                                  $7
  163    13      > RETURN                                                   null

End of function __construct

Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  run
number of ops:  13
compiled vars:  !0 = $code, !1 = $tokens
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  165     0  E >   RECV                                             !0      
  167     1        FETCH_OBJ_R                                      ~2      'table'
          2        INIT_METHOD_CALL                                         ~2, 'free'
          3        DO_FCALL                                      0          
  169     4        FETCH_OBJ_R                                      ~4      'lexer'
          5        INIT_METHOD_CALL                                         ~4, 'tokenize'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $5      
          8        ASSIGN                                                   !1, $5
  171     9        INIT_METHOD_CALL                                         'process'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
  172    12      > RETURN                                                   null

End of function run

Function read:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 0
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 0
filename:       /in/9lEte
function name:  read
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  177     0  E >   FETCH_OBJ_R                                      ~0      'table'
          1        INIT_METHOD_CALL                                         ~0, 'current'
          2        DO_FCALL                                      0  $1      
          3        SEPARATE                                         $1      $1
          4        INIT_NS_FCALL_BY_NAME                                    'AzJezz%5CBrainFuck%5Cord'
          5        INIT_NS_FCALL_BY_NAME                                    'AzJezz%5CBrainFuck%5Cfread'
          6        CHECK_FUNC_ARG                                           
          7        FETCH_OBJ_FUNC_ARG                               $3      'stdin'
          8        SEND_FUNC_ARG                                            $3
          9        SEND_VAL_EX                                              1
         10        DO_FCALL                                      0  $4      
         11        SEND_VAR_NO_REF_EX                                       $4
         12        DO_FCALL                                      0  $5      
         13        ASSIGN_OBJ                                               $1, 'value'
         14        OP_DATA                                                  $5
  178    15        FETCH_OBJ_R                                      ~6      'table'
         16        INIT_METHOD_CALL                                         ~6, 'current'
         17        DO_FCALL                                      0  $7      
         18        FETCH_OBJ_R                                      ~8      $7, 'value'
         19        IS_SMALLER                                               255, ~8
         20      > JMPNZ                                                    ~9, ->0
  179    21    > > RETURN                                                   null

End of function read

Function write:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9lEte
function name:  write
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  183     0  E >   INIT_NS_FCALL_BY_NAME                                    'AzJezz%5CBrainFuck%5Cfwrite'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $0      'stdout'
          3        SEND_FUNC_ARG                                            $0
          4        INIT_NS_FCALL_BY_NAME                                    'AzJezz%5CBrainFuck%5Cchr'
          5        CHECK_FUNC_ARG                                           
          6        FETCH_OBJ_R                                      ~1      'table'
          7        INIT_METHOD_CALL                                         ~1, 'current'
          8        DO_FCALL                                      0  $2      
          9        SEPARATE                                         $2      $2
         10        FETCH_OBJ_FUNC_ARG                               $3      $2, 'value'
         11        SEND_FUNC_ARG                                            $3
         12        DO_FCALL                                      0  $4      
         13        SEND_VAR_NO_REF_EX                                       $4
         14        DO_FCALL                                      0          
  184    15      > RETURN                                                   null

End of function write

Function process:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 2
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 63
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 14
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 50
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 50
Branch analysis from position: 62
Branch analysis from position: 50
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 37
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 37
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 37
Branch analysis from position: 36
Branch analysis from position: 37
Branch analysis from position: 32
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 71
Branch analysis from position: 67
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 79, Position 2 = 2
Branch analysis from position: 79
Branch analysis from position: 2
filename:       /in/9lEte
function name:  process
number of ops:  80
compiled vars:  !0 = $tokens, !1 = $token, !2 = $inner, !3 = $nest, !4 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  186     0  E >   RECV                                             !0      
  188     1      > JMP                                                      ->76
  192     2    >   INIT_METHOD_CALL                                         !0, 'current'
          3        DO_FCALL                                      0  $5      
          4        ASSIGN                                                   !1, $5
  194     5        INIT_METHOD_CALL                                         !1, 'kind'
          6        DO_FCALL                                      0  $7      
          7        IS_IDENTICAL                                             $7, 64
          8      > JMPZ                                                     ~8, ->63
  195     9    >   ASSIGN                                                   !2, <array>
  196    10        INIT_METHOD_CALL                                         !0, 'next'
         11        DO_FCALL                                      0          
  197    12        ASSIGN                                                   !3, 1
  199    13      > JMP                                                      ->37
  200    14    >   INIT_METHOD_CALL                                         !0, 'current'
         15        DO_FCALL                                      0  $12     
         16        ASSIGN                                                   !4, $12
  201    17        INIT_METHOD_CALL                                         !0, 'key'
         18        DO_FCALL                                      0  $14     
         19        ASSIGN_DIM                                               !2, $14
         20        OP_DATA                                                  !4
  203    21        INIT_METHOD_CALL                                         !4, 'kind'
         22        DO_FCALL                                      0  $16     
         23        IS_IDENTICAL                                             $16, 128
         24      > JMPZ                                                     ~17, ->27
  204    25    >   PRE_DEC                                                  !3
         26      > JMP                                                      ->32
  205    27    >   INIT_METHOD_CALL                                         !4, 'kind'
         28        DO_FCALL                                      0  $19     
         29        IS_IDENTICAL                                             $19, 64
         30      > JMPZ                                                     ~20, ->32
  206    31    >   PRE_INC                                                  !3
  209    32    >   INIT_METHOD_CALL                                         !0, 'next'
         33        DO_FCALL                                      0          
  211    34        IS_IDENTICAL                                             !3, 0
         35      > JMPZ                                                     ~23, ->37
  212    36    > > JMP                                                      ->40
  199    37    >   INIT_METHOD_CALL                                         !0, 'valid'
         38        DO_FCALL                                      0  $24     
         39      > JMPNZ                                                    $24, ->14
  216    40    >   ASSERT_CHECK                                             
         41        INIT_NS_FCALL_BY_NAME                                    'AzJezz%5CBrainFuck%5Cassert'
         42        IS_IDENTICAL                                     ~25     !3, 0
         43        SEND_VAL_EX                                              ~25
         44        SEND_VAL_EX                                              'assert%280+%3D%3D%3D+%24nest%29'
         45        DO_FCALL                                      0          
  217    46        INIT_NS_FCALL_BY_NAME                                    'AzJezz%5CBrainFuck%5Carray_pop'
         47        SEND_VAR_EX                                              !2
         48        DO_FCALL                                      0          
  219    49      > JMP                                                      ->56
  220    50    >   INIT_METHOD_CALL                                         'process'
         51        NEW                                              $28     'ArrayIterator'
         52        SEND_VAR_EX                                              !2
         53        DO_FCALL                         

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.61 ms | 1428 KiB | 27 Q