An elegant method to save a grammar using topologicpy is to store each rule as an edge and to store the whole grammar as a list of edges. The two vertices of each edge store the shapes (closed wires). The start vertex stores the left-side shape and the end vertex of the edge stores the right-side shape. The edge itself stores a dictionary with values that indicate its name, purpose, and any other needed information.