Consider the following Jison grammar:

%lex
%%
\s+                                             { /* skip whitespace */ }
"the"|"a"                                       { return "ARTICLE";     }
"go"|"jump"|"run"|"like"|"eat"                  { return "VERB";        }
"dog"|"cat"|"fish"|"fox"|"moose"                { return "NOUN";        }
"blue"|"red"|"orange"|"white"|"big"|"small"     { return "ADJECTIVE";   }
"quickly"|"easily"|"slowly"                     { return "ADVERB";      }
"over"|"under"|"around"|"through"|"between"     { return "PREPOSITION"; }
"."|"!"                                         { return "PUNCTUATION"; }    
<<EOF>>                                         { return "EOF";         }
.                                               { return "INVALID";     }

/lex

%start ss

%% /* language grammar */

ss
    : s "EOF"
    ;
s
    : nphrase "VERB" "PUNCTUATION"
    | nphrase "VERB" vmodifier "PUNCTUATION"
    | nphrase "VERB" nphrase "PUNCTUATION"
    ;
nphrase
    : modifiednoun
    | "ARTICLE" modifiednoun
    ;
modifiednoun
    : "NOUN"
    | nmodifier modifiednoun
    ;
nmodifier
    : "ADJECTIVE"
    | "ADVERB" nmodifier
    ;
vmodifier
    : "ADVERB"
    | "ADVERB" vmodifier
    | "PREPOSITION" nphrase
    ;

Now consider the following five strings:

  • a fox jump through red blue dog.
  • a small fox jump through red blue dog over the fish.
  • a small fox jump easily over the fish.
  • a small fox jump easily the fish.
  • a small fox jump the fish.

How many of these strings are parsed successfully according to the grammar above?

3

  • 0
  • 1
  • 2
  • 4
  • 5

For this problem, you must focus on the details of the given grammar instead of relying on your vast experience with actual English sentences.