Question: Write a recursive program to generate random sentences from a given BNF grammar. A BNF grammar is a recursively defined file that defines rules for
Write a recursive program to generate random sentences from a given BNF grammar. A BNF grammar is a recursively defined file that defines rules for creating sentences from tokens of text. Rules can be recursively self-similar. The following grammar can generate sentences such as “Fred honored the green wonderful child”:
::=
::= |
::=the|a
::=|
::=big|fat|green|wonderful|faulty|subliminal|pretentious
::=dog|cat|man|university|father|mother|child|television
::=John|Jane|Sally|Spot|Fred|Elmo
::= |
::=hit|honored|kissed|helped
::=died|collapsed|laughed|wept
Step by Step Solution
3.45 Rating (168 Votes )
There are 3 Steps involved in it
public class Board private int board stores board info private static final int UNASSIGNED 100 unassigned column Constructs an empty sizebysize board param size the size of the board exception Illegal... View full answer
Get step-by-step solutions from verified subject matter experts
