Question

Write a Context-Free grammar in either one of the following way: 1. Use recursion method to...

Write a Context-Free grammar in either one of the following way:

1. Use recursion method to define grammar inductively,

2. Use semantic meanning for non-terminals method

For the following language:

strings have equal numbers of 0 and 1. For example your language will accept following strings 01, 0101, 010101, 000111, 001011, but will reject 010, 00011, 001, 11000, ... .

Also show that grammar you created is ambiguos or not by using parse tree approach

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Write a Context-Free grammar in either one of the following way: 1. Use recursion method to...
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
  • 2. Consider the following context free grammar with terminals (), +, id, num, and starting symbol...

    2. Consider the following context free grammar with terminals (), +, id, num, and starting symbol S. S (ST) F-id Fnum a. Compute the first and follow set of all non-terminals (use recursion or iteration, show all the steps) Show step-by-step (the parsing tree) how the following program is parsed: (num+num+id)) b.

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

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

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

  • Problem 3. f10 points for each of the following context-free grammars, i)use set notation to define...

    Problem 3. f10 points for each of the following context-free grammars, i)use set notation to define the language generated by the grammar, and ii) Show that it is ambiguous by drawing 2 different parse trees for a string. a) Grammar: S + SaSb Si S + Sja | SibT T + Tb Tac b) Grammar: S + 151 T T + 1X1 X X + 0X01

  • I need help with the following problems, any help you can provide is deeply appreciated! CSC...

    I need help with the following problems, any help you can provide is deeply appreciated! CSC 404 Exam 1 Question I continued - 9. The syntax rules for most languages ignore spaces. An exception is which tises indents and therefore spaces to form the indents) to group statements (a) FORTRAN (6) Pascal (e) Python (d) Lip (e) C++ 10. Identifiers, constants and operators are typical examples of (a) tokens. (b) leafons. (c) signifiers. (d) lexicons. (e) parsicles. 0) non-terminals. 11....

  • 1. (p. 2-3.) Which of the following is NOT a reason for studying concepts of programming...

    1. (p. 2-3.) Which of the following is NOT a reason for studying concepts of programming languages according to Sebesta? a. Increased capacity to express ideas. b. Improved background for choosing appropriate languages. c. Increased ability to design new languages. d. Increased ability to learn new languages. 2. (p. 5-6.) What programming language has dominated scientific computing over the past 50 years? a. FORTRAN b. ALGOL c. SNOBOL d. PL/I 3. (p. 6.) What programming language has dominated artificial intelligence...

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