Question

Question 1 Consider CFG: A => OA1A01 epsilon, Which of these strings can be generated with this grammar? 001100 0011 00100 01
0 0
Add a comment Improve this question Transcribed image text
Answer #1

All the options are correct we can derive each option using the grammar given.

Option 1-

Rule Application Result
Start → A Start A
A → 0A A 0A
A → 0A 0A 00A
A → 1A 00A 001A
A → 1A 001A 0011A
A → 0A 0011A 00110A
A → 0 00110A 001100

OR

Rule Application Result
Start → A Start A
A → 0A A 0A
A → 0A 0A 00A
A → 1A 00A 001A
A → 1A 001A 0011A
A → 0A 0011A 00110A
A → 0A 00110A 001100A
A → ɛ 001100A 001100

Option 2-

Rule Application Result
Start → A Start A
A → 0A A 0A
A → 0A 0A 00A
A → 1A 00A 001A
A → 1 001A 0011

Or

Rule Application Result
Start → A Start A
A → 0A A 0A
A → 0A 0A 00A
A → 1A 00A 001A
A → 1A 001A 0011A
A → ɛ 0011A 0011

Option3-

Rule Application Result
Start → A Start A
A → 0A A 0A
A → 0A 0A 00A
A → 1A 00A 001A
A → 0A 001A 0010A
A → 0 0010A 00100

Or

Rule Application Result
Start → A Start A
A → 0A A 0A
A → 0A 0A 00A
A → 1A 00A 001A
A → 0A 001A 0010A
A → 0A 0010A 00100A
A → ɛ 00100A 00100

Option 4-

Rule Application Result
Start → A Start A
A → 0A A 0A
A → 1A 0A 01A
A → 1A 01A 011A
A → 0 011A 0110

Or

Rule Application Result
Start → A Start A
A → 0A A 0A
A → 1A 0A 01A
A → 1A 01A 011A
A → 0A 011A 0110A
A → ɛ 0110A 0110

Note: In each case, ambiguity arises as we can derive each option in two ways.

Add a comment
Know the answer?
Add Answer to:
Question 1 Consider CFG: A => OA1A01 epsilon, Which of these strings can be generated with...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • can you plzz do question 1 and 2 Question 1. Design a CFG for the language...

    can you plzz do question 1 and 2 Question 1. Design a CFG for the language over = {1, #} whose elements consist of every pair of distinct, #-separated unary values: L = {rı#x2 | 21, 22 € 1", 21 * x2}. Question 2. Design a CFG for the language of binary strings that contain at least one 1 in their second half: L = {uv | UE (OU 1)", v € OU 1)*1(0U 1)", [u '}. Question 3. This...

  • Design a CFG for the strings over {0,1} which contain more 1’s than 0’s. Hint: Draw...

    Design a CFG for the strings over {0,1} which contain more 1’s than 0’s. Hint: Draw possible “hill/valley” plots. Dissect each segment you see into simpler structures you’ve seen before. Design a CFG for each, and then piece them together.

  • 1. Give a context-free grammar for the set BAL of balanced strings of delimiters of three...

    1. Give a context-free grammar for the set BAL of balanced strings of delimiters of three types (), and . For example, (OOis in BAL but [) is not. Give a nondeterministic pushdown automata that recognizes the set of strings in BAL as defined in problem 1 above. Acceptance should be by accept state. 2. Give a context free grammar for the language L where L-(a"b'am I n>-o and there exists k>-o such that m-2*ktn) 3. Give a nondeterministic pushdown...

  • Question 9 (10 points) Consider the following EBNF grammar for a “Calculator Language": <calculation> → <expr>=...

    Question 9 (10 points) Consider the following EBNF grammar for a “Calculator Language": <calculation> → <expr>= <expr> <term> (+1-) <expr> <term> <term> <factor> (* ) <term> <factor> <factor> → (<expr>) <value> <value> → [<sign> ] <unsigned> [. <unsigned> ] <unsigned> <digit> { <digit> } <digit> → 01|2|3|4|567| 8 | 9 <sign> → +|- which of the following sentences is in the language generated by this grammar ? Why? a. 3/+2.5 = b. 5-*3/4= c. (3/-2) + 3 = d. 5...

  • Question 2 Which language is generated by the grammar below? S → OA | 1B A...

    Question 2 Which language is generated by the grammar below? S → OA | 1B A 1A | 11 BOBO Select the correct answer. L= {W : € {0,1}} L = {01" :n > 2} U{10 : m >0} L = {01": n > 2} {10% : m > 1} L = {Owll: w € {0,1}} {lwo: W € {0,1}}

  • QUESTION 3 Here is a nondeterministic finite automaton with epsilon-transitions. 1 1 Start €,0 0 €...

    QUESTION 3 Here is a nondeterministic finite automaton with epsilon-transitions. 1 1 Start €,0 0 € 90 91 92 93 95 94 Which of the following strings is NOT accepted? 10101 01110 01111 11110 The following nondeterministic finite automaton: 1 0 А B 0 1 accepts which of the following strings? 1001011 0111011 0101010 1010101

  • can you answer both of these please. QUESTION 1 Given two languages L(A, b ) and...

    can you answer both of these please. QUESTION 1 Given two languages L(A, b ) and M -(aa,A], which of the following is the product of LM? aa.aaa,baa.a,사 (aa,baa,b.A (aa,aaa,baa,b,a QUESTION 2 Given the grammar S->aTb Which of the following strings cannot be generated by the grammar ? ab abbb Click Save and Submit to save and submit. Click Save All Answers to save all answers.

  • Question 9 (10 points) Consider the following EBNF grammar for a "Calculator Language": <calculation> <expr> =...

    Question 9 (10 points) Consider the following EBNF grammar for a "Calculator Language": <calculation> <expr> = <expr> > <term> (+1-) <expr> <term <term> <factor> (* ) <term> <factor> <factor> > (<expr>) value> <value> → [<sign> ] <unsigned [. <unsigned> ] <unsigned> <digit> { <digit> } <digit → 011121314151617189 <sign → + - which of the following sentences is in the language generated by this grammar? Whx.2 a. 3/+2.5 = b. 5- *3/4= c. (3/-2) + 3 = d. 5++3 =

  • 1. (15 pts) Consider the following BNF grammar: For each of the strings below, indicate whether...

    1. (15 pts) Consider the following BNF grammar: For each of the strings below, indicate whether or not the string can be derived from the grammar. ?f so, provide a derivation. (a) (5 pts) aabccd (b) (5 pts) accbcc (c) (5 pts) acccce

  • Select all the alternative(s) (1 or more) that show(s) strings generated by the following regex: (...

    Select all the alternative(s) (1 or more) that show(s) strings generated by the following regex: ( 1 ∪ ε ) ( 01 ) ∗ ( 0 ∪ ε )IMPORTANT NOTICE: There will not be any partial credits assigned to this question. You need to select all alternatives that are correct to receive 4 points. Group of answer choices 1010101 0011001100 1100110011 10 0101010

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT