public function filter(int $value) : string
    {
        if ($value < 0) {
            throw new Exception(sprintf('Invalid integer: %d', $value), Exception::INVALID_INTEGER);
        }

        $tokens = $this->getGrammar()->getTokens();
        $values = array_reverse($this->getGrammar()->getValuesWithModifiers(), true /* preserve keys */);
        $result = '';

        if ($value === 0) {
            $dataset = $values[0];

            foreach ($dataset as $token) {
                $result = $result . $tokens[$token];
            }

            return $result;
        }

        foreach ($values as $current => $dataset) {
            while ($current > 0 && $value >= $current) {
                $value = $value - $current;
                foreach ($dataset as $token) {
                    $result = $result . $tokens[$token];
                }
            }
        }

        return $result;
    }