Q:

pyparsing how to create grammar object from string

I am having grammar for my pyparsing application in DB. They are in String format. I want to convert the same to the grammer object in my application and struck up with it.
Word(alphas) + Word(nums)

Above snippet is one of the entries in the database for which i need to construct grammer object
Can any one let me know how it can be accomplished

A:

If I understand correctly, you can use the eval or exec. For Example:
g = eval("Word(alphas) + Word(nums)")

