I'm trying to think about the appropriate data structure for storing grammatical paradigms. I want something like an associative array, but with an arbitrary number of dimensions. In a simple case, it's easy to think of the data structure. If the two dimensions of the paradigm are as follows...
Gender (Masculine, Feminine, Neuter)
Case (Nominative, Accusative, Dative, Genitive)
... then it makes sense to use a hash map in C++, or an associative array in PHP:
$value['Masculine']['Accusative'] = 'foo';
$value['Neuter']['Dative'] = 'foo';
The problem is that, for a given language, any number of ‘dimensions’ might be important. (There is surely an upper bound, but I don't know what that is in advance.) I want the user to specify what the important values are, and to be able to change them dynamically as well.
Is there any sort of data structure that has that flexibility, or would I need to create my own with a special class, or something like that?