Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please work on 6 , 7 and 8 Part I: Defining Program Syntax Exercises ( 2 0 Points ) Give a BNF grammar for each

please work on 6,7 and 8
Part I: Defining Program Syntax Exercises (20 Points)
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:
::= ab |
There are often many correct answers.
(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]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions