Question: Problem #1Give a BNF and an EBNF grammar for each of the languages below. Use the EBNF extensions whenever possible to simplify the grammars. In
Problem #1Give a BNF and an EBNF grammar for each of the languages below. Use the EBNF extensions whenever possible to simplify the grammars. In particular, you should eliminate explicit recursion from the grammars whenever possible. Dont forget to put single quotes around any EBNF metasymbol when using it as a token.
a. The set of all strings consisting of the keyword begin, followed by one or more statements with a semicolon after each one, followed by the keyword end. Use the nonterminal for statements, and do not give productions for it.
b. The set of all strings consisting of one or more as, with a comma between each a and the next. (There should be no comma before the first or after the last.)
c. The set of all strings consisting of an open bracket (the symbol [) followed by a list of one or more digits separated by commas, followed by a closing bracket (the symbol ]).
d. The set of all strings consisting of zero or more as, with a comma between each a and the next. (There should be no comma before the first or after the last.)
e. The set of all strings consisting of an open bracket (the symbol [) followed by a list of zero or more digits separated by commas, followed by a closing bracket (the symbol ]).
Problem #2 Give a syntax diagram for each of the languages of Problem #1. Use branching and loops in your syntax diagrams to make them as clear as possible.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
