diff --git a/clang/tools/clang-pseudo/ClangPseudo.cpp b/clang/tools/clang-pseudo/ClangPseudo.cpp --- a/clang/tools/clang-pseudo/ClangPseudo.cpp +++ b/clang/tools/clang-pseudo/ClangPseudo.cpp @@ -24,6 +24,7 @@ static opt Grammar("grammar", desc("Parse and check a BNF grammar file."), init("")); +static opt PrintGrammar("print-grammar", desc("Print the grammar.")); static opt PrintGraph("print-graph", desc("Print the LR graph for the grammar")); static opt PrintTable("print-table", @@ -60,6 +61,8 @@ } llvm::outs() << llvm::formatv("grammar file {0} is parsed successfully\n", Grammar); + if (PrintGrammar) + llvm::outs() << G->dump(); if (PrintGraph) llvm::outs() << clang::syntax::pseudo::LRGraph::buildLR0(*G).dumpForTests( *G);