import nltk
grammar = nltk.parse_cfg(
    """
DATE -> MONTH SEP DAY SEP YEAR
SEP -> "/"
MONTH -> DIGIT | DIGIT DIGIT
DAY -> DIGIT | DIGIT DIGIT
YEAR -> DIGIT DIGIT DIGIT DIGIT
DIGIT -> '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0'
"""
    )
parser = EarleyChartParser(grammar)
print(parser.parse(['1', '/', '1', '0', '/', '1', '9', '8', '7']))
Using integers/dates as terminals in NLTK parser