This grammar in the article is ambiguous, and the article says that
ambiguity is part of the design. Hence you need a parser that can
handle ambiguity. Many context-free parsers will not do that.
However, NLTK does offer a chart parser, i.e., an algorithm (based on
dynamic programming) that can parse any context-free grammar and give
you ways of dealing with the multiple possible parses that a sentence
may have when the grammar is ambiguous.
However I have no experience with it, and I do not know (for lack of a
formal presentation that I did not find in the time I had available)
how easily and effectively it deals with multiple parse trees, of
which there can be a large number.
Another problem that I see is that the grammar you wish to use is a
grammar for discourse structure, rather than for sentences. This is
not inherently a problem but has its own specificity.
When parsing an English sentence, you need a first phase that recognizes the
various lexical elements of your language, and identifies their
possible lexical categories (parts of speech).
Here, you obviously have to identify "parts of discourse" which are
the terminal of the discourse context free syntax you want to parse.
I guess they are denoted in figure 2 by lower case letters.
Hence, you may have to cascade two parsers, an English parser to
recognize your "parts of discourse", which are used by the second
parser to analyze your discourse structure.
Most likely, the NLTK parser can handle both. But I do not have hands
on experience with it, and the description provided is far too long
for me to have time to grasp its structure without a more condensed
Regarding extended rules, such as "T => A+ D", if the parser cannot
handle them directly, they can easily be changed into the usual
context-free rules. This example can be rewritten as:
T => A T and T=> A D