def is_grammar_generating(grammar, remove=False):
        # type: (Grammar, bool) -> bool
        """
        Check if is grammar is generating.
        Generating grammar generates at least one sentence.
        :param grammar: Grammar to check.
        :param remove: True to remove nongenerating symbols from the grammar.
        :return: True if is grammar generating, false otherwise.
        """
        g = ContextFree.remove_nongenerating_nonterminals(grammar, remove)
        return g.start is not None
Check if is grammar is generating.
        Generating grammar generates at least one sentence.
        :param grammar: Grammar to check.
        :param remove: True to remove nongenerating symbols from the grammar.
        :return: True if is grammar generating, false otherwise.