An esolang (esoteric language) is a programming language designed to be used as a joke or test the limits of what can be achieved with a particular language syntax. Brainf*ck is a minimal esolang and the original implementation only consisted of 8 symbols — >, Move pointer to next cell => */ public function tokenise(string $input): array { $chars = str_split($input); $tokens = []; return $tokens; }}
protected function node(): Node { if ($this->current === Token::Plus) { $this->next(); return new IncrementNode; } elseif ($this->current === Token::Minus) { $this->next(); return new DecrementNode; } elseif ($this->current === Token::RightDoubleArrow) { $this->next(); return new MoveRightNode; } elseif ($this->current === Token::LeftDoubleArrow) { $this->next(); return new MoveLeftNode; } elseif ($this->current === Token::Dollar) { $this->next(); return new ReadByteNode; } elseif ($this->current === Token::Echo) { $this->next(); return new EchoNode; } elseif ($this->current === Token::Backslash) { $this->next(); $nodes = []; while ($this->current !== null && $this->current !== Token::Slash) { $nodes[] = $this->node(); } $this->expect(Token::Slash); return new WhileNode($nodes); } else { throw UnexpectedTokenException::make($this->current); }} protected function expect(Token $token): void { if ($this->current !== $token) { throw UnexpectedTokenException::make($this->current); } $this->next(); } protected function next(): void { $this->position++; $this->current = $this->next; $this->next = $this->tokens[$this->position + 1]?? null; }}