protected void createCommands() {
        commands = new HashMap<>();
        commands.put(TokenType.INCREMENT_POINTER, ArrayMemory::incrementPointer);
        commands.put(TokenType.DECREMENT_POINTER, ArrayMemory::decrementPointer);
        commands.put(TokenType.INCREMENT, ArrayMemory::increment);
        commands.put(TokenType.DECREMENT, ArrayMemory::decrement);

        commands.put(TokenType.WRITE, memory -> {
            try {
                memory.write(getIn().read());
            } catch (IOException e) {
                e.printStackTrace();
            }
        });

        commands.put(TokenType.READ, memory -> {
            getOut().write(memory.read());
            getOut().flush();
        });
    }