Question

Automata Theory

I've given my answer to 3d. Is it correct? If not, please correct it. Thanks

3. Context-free languages are useful for the definition of programming languages. For example, we have looked at grammars for

3. Context-free languages are useful for the definition of programming languages. For example, we have looked at grammars for defining Lisp and C. (a) Give a context-free language that is not regular, establishing the added power of CFL (b) What language is accepted by the following grammar: (c) Build a context-free grammar for the language (wb w-wR, k 0 a,by (d) Build a context-free grammar for the language of nested parentheses. A left parenthesis should always precede its matching right parenthesis. Two strings in this language are () and (00)0. This grammar could be used to check the syntactic correctness of a Lisp expression.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

3d)

      E --> EE | LER | ε

      L --> (

      R --> )

EE is used to produce parenthesis side by side.

LER is used to produce recursive parenthesis.

symbol L is used to produce left parenthesis.

symbol R is used to produce right parenthesis.

ε - empty string.

Add a comment
Know the answer?
Add Answer to:
Automata Theory I've given my answer to 3d. Is it correct? If not, please correct it. Thanks
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
  • 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...

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