1A. Give a grammar that generates all real constants in C++. 1B. Let ? = {a, b}, find a DFA with 3 states for accepting the language L = { w : (na(w) + 2nb(w)) mod 3 < 2 } 1C. Using mark and reduce procedure, minimize the DFA in Figure 1C.
Added by Mar G.
Close
Step 1
To generate all real constants in C++, we can use the following grammar: S -> D | D.E | D.EE D -> D1 | D1D2 D1 -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 D2 -> D1 | ε E -> E1 | E1E2 E1 -> + | - | ε E2 -> D | D.E | D.EE Here, S is the start symbol, D represents the Show more…
Show all steps
Your feedback will help us improve your experience
Sri K and 82 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
1. (10 points) DFA's: Design an DFA that recognizes the language L1 with the alphabet {0,1} (Draw the state diagram). L1 = {w ∈ {0, 1}* | w contains 11 as a substring} 2. (10 points) DFA's: Design an DFA that recognizes the language L2 with the alphabet {2,3} (Draw the state diagram). L2 = {w ∈ {2, 3}* | w ends with substring 23} 3. (10 points) NFA's: Design an NFA that recognizes the language L3 = L1 ∪ L2 with the alphabet {0, 1, 2, 3} (Draw the state diagram). 4. (10 points) Regular Expressions: Give a regular expression for L3. 5. (10 points) Design a Context-free grammar for L3 (specify the 4-tuple and all of the rules. Need not be in Chomsky normal form)
Sri K.
Akash M.
Build a DFA for the following language: L = { w | w is a string over a , and b starts ( aa or bb ) and ends with ( aa or bb ) L = { w | w is a binary string that has even number of 1s and even number of 0s} The set of all strings whose tenth symbol from the left end is a 1. The set of strings that either begin or end (or both) with 01 Let = Σ ={0, 1} , Give DFA's accepting The set of all binary string , which are divisible by 3. Let = Σ ={0, 1} , Give DFA's accepting The set of all binary string , which are divisible by 5. Let = Σ ={0, 1} , Give DFA's accepting The set of all binary strings start with 1 , and divisible by 5.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD