For language $ L$ over an alphabet $ \Sigma$ denote $ \gamma_L(n)$ as the number of words of length $ n$ in the language $ L$ . It is known that for regular languages this function represents a sequence with rational generating function (which is equivalent to that $ \gamma_L(n)$ is linear-recurrent for sufficiently large coefficients).
However, I couldn’t find any information about non-regular languages. And it is not clear how to extend the result, stated above to some other types of languages.
Does anyone know the conditions for some non-regular classes of languages (for example, prefix-closed languages) to have rational geodesic growth function?