Question

2. 6 pt] Define a BNF grammar that generates the set of all palindromes on the alphabet Σ { a, b }. For example, the strings a, abba, babab are in the language, while the strings ab, baba, baa are not.

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

If you want a grammer in bnf to generate all pallindrom string you can use the below grammer-

<palindrome> ::= b | a | bb | aa | b<palindrome>b | a<palindrome>a

Add a comment
Know the answer?
Add Answer to:
2. 6 pt] Define a BNF grammar that generates the set of all palindromes on the...
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 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...

  • Define Context-free grammar Matching syntactic entities (e.g., parentheses, brackets, or braces) is an important aspect of...

    Define Context-free grammar Matching syntactic entities (e.g., parentheses, brackets, or braces) is an important aspect of many programming languages. Define a context-free grammar in BNF capable of generating only balanced strings of (nested or flat) matched parentheses. The empty string is not in this language. For instance, the strings (), ()(), (()), (()())(), and ((()())()) are sentences in this language, while the strings )(, )(), )()(, (()(), ())((, and ((()()) are not. Note that not all strings with the same...

  • Please help me with this... Give a regular grammar that generates the described language. The set...

    Please help me with this... Give a regular grammar that generates the described language. The set of strings of odd length over {a, b} that contain exactly two b's.

  • (5 pts, 1 pt each) Define or explain the following terms: function countable set language over...

    (5 pts, 1 pt each) Define or explain the following terms: function countable set language over an alphabet S left-most derivation on a grammar G lambda rule in grammar G

  • (a) Give 2 strings that are members of language specified by the regular expression (0+ 1)∗...

    (a) Give 2 strings that are members of language specified by the regular expression (0+ 1)∗ but are not members of the language specified by 0∗ + 1∗ . Then give 2 strings that are members of both languages. Assume the alphabet is Σ = {0, 1}. (b) For each of the following languages specified by regular expressions, give 2 strings that are members and 2 strings that are not members (a total of 4 strings for each part). Assume...

  • Consider the following BNF grammar: S ::= A x | B y A ::= B y...

    Consider the following BNF grammar: S ::= A x | B y A ::= B y | C w B ::= x | B w C ::= y Which of the following regular expressions describes the same set of strings as the grammar? 1. xwxy + xww∗y + ywx 2. xwx + xww∗y + yw 3. xw∗y + xwxyx + ywx 4. xwy + xw∗xyx + ywx 5. xw∗y + xw∗yx + ywx 6. none of the above 7. all...

  • Please help and show full steps will upvote thanks! Define a context-free grammar (CFG) that generates...

    Please help and show full steps will upvote thanks! Define a context-free grammar (CFG) that generates exactly the following language. B = {1'0'ik | i+j = k or i+k=j with i, j, k > 0} Both ambiguous and unambiguous grammars are acceptable (it does not matter in this question). For grading purposes, please use as the starting variable. Alphabet E = {0,1}

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

  • the following grammar generates all regular expressions over the alphabet of letters (we have used quotes...

    the following grammar generates all regular expressions over the alphabet of letters (we have used quotes to surround operators, since the vertical bar is an operator as well as a metasymbol): rexp->rexp “|” rexp | rexp rexp | rexp “*” | “(” rexp “)” | letter a. give a derivation for the regular expression (ab|b)* using this grammar. b. show this grammar is ambiguous c. Rewrite this grammar to establish the correct precendences for the operators. d. What associativity does...

  • Recursive Descent Parsing Consider the following BNF grammar: A -> I = E E -> P...

    Recursive Descent Parsing Consider the following BNF grammar: A -> I = E E -> P O P | P O -> + | - | * | / | ** P -> I | L | UI | UL | (E) U -> + | - | ! I -> C | CI C -> a | b | ... | y | z L -> D | DL D -> 0 | 1 | ... | 8 |...

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