Give a BNF grammar for each of the languages below. For example, a correct answer for “the set of all strings consisting

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Give a BNF grammar for each of the languages below. For example, a correct answer for “the set of all strings consisting

Post by answerhappygod »

Give a BNF grammar for each of the languages below. For example,
a correct answer for “the set of all strings consisting of zero or
more concatenated copies of the string “ab” would be this
grammar:
<S> ::= ab <S> | <empty>
(2 points) The set of all strings consisting of one or more
instances of the letter a.
(3 points) Show that your grammar can derive the following
sentences:
a
aa
aaa
(2 points) The set of all strings consisting of one or more
instances of the letter a with a semicolon after each one.
(3 points) Show that your grammar can derive the following
sentences:
a;
a; a;
a; a; a;
(2 points) The set of all strings consisting of an uppercase
letter followed by zero or more additional characters, each of
which is either an uppercase letter or one of the digits 0 through
9.
(3 points) Show that your grammar can derive the following
sentences:
A
AA
A1
AA1
A1A
(2 points) 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 ] ). Note that
the digits are 0 through 9.
(3 points) Show that your grammar can derive the following
sentences:
[0]
[0,1]
[0,1,2]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply