Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer these questions right. Read very carefully before answering. Answer each part 1 . Write BNF grammar for the if / else conditional statement

please answer these questions right. Read very carefully before answering. Answer each part
1. Write BNF grammar for the if/else conditional statement of C. Assume the following for this:
You already have defined for you and and nonterminals. You SHOULD NOT define them or redefine them, just use them as nonterminals.
Block is NOT the same as a statement (different books take different take on this)- block is {} with variables and statements inside. Do not use the extended BNF notation.
2. Design a regular language where every sentence has to start with any number of strings 10(any number is none or more), then repeats 0101 any number of times, then repeats 01 at least once (but could be more). Use regular expression notation.
Clarification: alphabet is {0,1}. 'string' is the same as a program in this context, but here the programs are written using the binary alphabet so strings here are binary; in regular expressions we use * for any number, + for one or more, | for either and () for grouping.
3. For the above, how many different valid strings there are?
4. For the above, how many valid strings are there if we restrict the total length to at most 10 bits? Give your reasoning for this. Remember that if the strings are identical, even if they were derived in a different way, they are still the same strings.

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 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions