export BNF

Sep 25, 2013 at 4:07 PM
My grammar is generated programmatically. I'd like to analyze the generated grammar. Is there some existing way to generate BNF from the Grammar class? Any code to recurse through the grammar itself?
Coordinator
Sep 25, 2013 at 7:38 PM
Well, you can either work with original grammar.Root nonterminal - this is the root of the tree, and iterate through Rule property of all nonterms
Or you can construct the ParserData (when you create parser) and use the GrammarData instance (it is 'processed' data) to iterate thru, just like Parser builder does.
Sep 28, 2013 at 11:44 AM
Edited Sep 28, 2013 at 11:45 AM
you can use the static methods of ParserDataPrinter class to print/save to file the terminal /non terminal :
The methods are:
  • PrintTerminals
  • PrintNonTerminals
  • PrintStateList