How to read Feature Based Grammar from a string
You need to take care of NP and VP expansion production.

# ###################
# Grammar Productions
# ###################
# S expansion productions
S -&gt; NP[NUM=?n] VP[NUM=?n]
# NP expansion productions
NP[NUM=?n] -&gt; N[NUM=?n]
NP[NUM=?n] -&gt; PropN[NUM=?n]
NP[NUM=?n] -&gt; Det[NUM=?n] N[NUM=?n]
NP[NUM=pl] -&gt; N[NUM=pl]
# VP expansion productions
VP[TENSE=?t, NUM=?n] -&gt; IV[TENSE=?t, NUM=?n]
VP[TENSE=?t, NUM=?n] -&gt; TV[TENSE=?t, NUM=?n] NP