- write C code to check to see if an input string can be derivedfrom a grammar. The grammar is:
A ::= 0 B
B ::= 1 A | 2 B | ;
Your program “check.c” should output “yes” if the line ofstandard input can be derived from this grammar, and “no”otherwise. Here are some examples:
$ ./check
0 ;
yes
$ ./check
0 2 1 ;
no
$
The input values will always be separated by spaces, as shownabove.
Solution