This project has moved and is read-only. For the latest updates, please go here.

export BNF

Sep 25, 2013 at 5: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?
Sep 25, 2013 at 8: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 12:44 PM
Edited Sep 28, 2013 at 12:45 PM
you can use the static methods of ParserDataPrinter class to print/save to file the terminal /non terminal :
The methods are:
  • PrintTerminals
  • PrintNonTerminals
  • PrintStateList