Question

1) a. Write down an unambiguous grammar that generates the set of strings                         {...

1) a. Write down an unambiguous grammar that generates the set of strings

                        { s;, s;s, s;s;s;, . . . }

      b. Give a leftmost and rightmost derivation for the string s;s; using your grammar.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) SA; S/A; As Derivation (b) Lelt Most Desiration Right Most s A; S S AS S, S s; A; 7 » A; A; - A; S; S; S; sisy

Add a comment
Know the answer?
Add Answer to:
1) a. Write down an unambiguous grammar that generates the set of strings                         {...
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
  • For the grammar <A> ::= <A><A> '+' | <A><A> '*' | 'a' and the string aa...

    For the grammar <A> ::= <A><A> '+' | <A><A> '*' | 'a' and the string aa + a* Give the leftmost derivation Give the rightmost derivation Give a parse tree Is the grammar ambiguous or unambiguous? (Justify your answer) Describe the language generated by this grammar

  • For both of the following languages, provide a grammar that generates it, an intuitive explanatio...

    Please actually answer it For both of the following languages, provide a grammar that generates it, an intuitive explanation why this grammar generates this language, and a graphical representation of a push-down automaton that recognizes this language. (a) The language of properly nested sets of parentheses over the alphabet G)). Note that the string (COO))) belongs to this language, while the string (O) () does not because the third closing parenthesis does not have a matching opening parenthesis. Provide a...

  • Given the following ambiguous context free grammar (3x20) 1. (a) Explain why the grammar is ambiguous...

    Given the following ambiguous context free grammar (3x20) 1. (a) Explain why the grammar is ambiguous (b) Find an equivalent unambiguous context-free grammar. (c) Give the unique leftmost derivation and derivation tree for the string s generated from the unambiguous grammar above. 2. Construct non-deterministic pushdown automata to accept the following language (20) 3. Convert the following CFG into an cquivalent CFG in Chomsky Normal Form (CNF) (20)-

  • Problem 1. Consider the grammar S → Y X Y X → a Y | Y...

    Problem 1. Consider the grammar S → Y X Y X → a Y | Y Y → b b Y | X | ε where a and b are tokens. Remember that ε represents the empty string. Y → ε means that Y does not have to match any tokens. 1. Give a leftmost derivation for the string (sequence of tokens): bbabbabb 2. Give a rightmost derivation for the string (sequence of tokens): bbabbabb

  • (a) Give an unambiguous CFG for arithmetic expression consisting of the four operations +,-,*,/ and a...

    (a) Give an unambiguous CFG for arithmetic expression consisting of the four operations +,-,*,/ and a start symbol S and terminal symbols 0,1,2,...9. Assume that *,/ havbe higher precedence than +,-. (b) Show the leftmost derivation tree of the expression 2 + 3 ∗ 5/6 − 1 using your grammar.

  • Give an unambiguous grammar for the same language generated by the grammar: <fruit>* : -<yellow» | <red&gt...

    Give an unambiguous grammar for the same language generated by the grammar: <fruit>* : -<yellow» | <red> <yellow» banana |mango | <empty> <red> ::- cherry | apple | <empty> "Same language" means that the unambiguous grammar can generate exactly the same set of strings as the ambiguous grammar. No more; no fewer. There will of course be a difference in how - by what NTSs and productions - at least some of those strings are generated * : -

  • 3 points) Question Three Consider the context-free grammar S >SS+1 SS 1a and the string aa...

    3 points) Question Three Consider the context-free grammar S >SS+1 SS 1a and the string aa Give a leftmost derivation for the string. 3 points) (4 poiots) (5 points) (3 points) sECTION IWOLAttcmpt.any 3.(or 2) questions from this.scction Suppose we have two tokens: (1) the keyword if, and (2) id-entifiers, which are strings of letters other than if. Show the DFA for these tokens. Give a nightmost derivation for the string. Give a parse tree for the string i) Is...

  • 1. For the following grammar: a) Give an example of a string accepted by the grammar. b) Give an ...

    Theory of Computation need ASAP 2-3 hours 1. For the following grammar: a) Give an example of a string accepted by the grammar. b) Give an example of a string not accepted by the grammar. c) Describe the language produced by the grammar. 2. Using the following grammar find a derivation for the string: 0001112 A0A1le C 0C2 | D Create a grammar for the language described by the following RE: Create a grammar for the following language: For the...

  • Consider the following grammar (G1) for simple assignment statements. (The symbols in double quotation marks are...

    Consider the following grammar (G1) for simple assignment statements. (The symbols in double quotation marks are terminal symbols.) assign → id “ = ” expr id → “A” | “B” | “C” expr → expr “ + ” expr | expr “ ∗ ” expr | “(” expr “)” | id a) Give a (leftmost) derivation for string A = B ∗ A + C. b) Give the parse tree for string A = B ∗ A + C. c)...

  • 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...

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
ADVERTISEMENT