Figure 2. Define Your Data Structure.
An important prerequisite to creating dynamic grammars is to create a data structure that can accommodate such grammars. For maximum flexibility, I advise that you create a structure that can support an unbalanced tree. This flexibility is important because you don't always know what direction an application will ultimately take, so the more options you can leave yourself up front, the better your application will be able to accommodate change down the road.