4. What is the language described by the grammar? How many sentences does the language contain?
<Z> ::= <L> | <L> <L> | <L> <L> <L>
<L> ::= a | b | c
Please explain, I do not understand these problems
Given grammar is
<Z> ::= <L> | <L> <L> | <L> <L> <L>
<L> ::= a | b | c
Here variable <L> generates terminal a ,b, or c.
(i) If we take <Z> ::= <L>
There will be three sentences {a,b,c}
(ii) If we take <Z> ::= <L> <L>
There will be 9 sentences , { aa, bb, cc, ab, bc, ca, ba , cb , bc }
(iii) If we take <Z> ::= <L> <L> <L>
There will be 21 sentences , { aaa , bbb, ccc ,aab ,abc , aca ,aba ,acb ,aac ,abb ,bbc , cba ,bba ,cbb ,abc , acb , bcc ,cca ,bca ,ccb ,acc }
This language contains total of 33 sentences.
Language contains identifier over the input alphabet set { a,b,c} of length at most three.
4. What is the language described by the grammar? How many sentences does the language contain?...
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.
(8) (3 marks) Write BNF grammar rules for a language that is comprised only of sentences described as follows: symbol, fol symbols orjust onéx symbol, A sequence of one or more occurrences of an a lowed by either zero or morez followed by a sequence of one or more b symbols. (9) (1 mark) The following fragment of grammar describes the syntax of the exponentiation operator. What is the associativity ot the operator as detined here? factor | expr factor...
The grammartofsm algorithm:
Let L be the language described by the following regular grammar: a. For each of the following strings, indicate whether it is a member of L: v. zyyzz b. Use grammartofsm (Rich 2008; page 157) to construct an FSM that accepts L c. Give a concise (but complete) description of L in plain English. We were unable to transcribe this image
please I need it urgent thanks. subject programming
language and compilers
w does not contain Question 2 Consider the following language over the alphabet = {a,b}: L = {w the substring aa} 1. What is I, the complement of L? 2. Write a regular expression for L. 3. Write a regular expression for L. 4. Design a DFA for I. 5. Modify the DFA for I to make it a DFA for L.
4. Consider the following context-free grammar S SSSS a (a) Show how the string aa+a* can be generated by this grammar (b) What language does this grammar generate? Explain
Question 5 a. How many lone electrons does iridium contain? b. How many lone electrons does Rut4 contain? c. How many lone electrons does Mo+3 contain?
7. What language does the grammar with these productions generate (5 points)? S + Aa, AB, B → Aa
Construct a context-free
grammar generating L. You do not need an inductive proof, but you
should explain how your construction accounts for each rule.
Let L be the language over {a,b,c} accepting all strings so that: 1. No b's occur before the first c. 2. No a's occur after the first c. 3. The last symbol of the string is b. 4. Each b that is not the last symbol is immediately followed by at least two d's. 5. There...
Give a context free grammar for the language L where L = {a"bam I n>:O and there exists k>-o such that m=2"k+n) 3. Give a nondeterministic pushdown automata that recognizes the set of strings in L from question 3 above. Acceptance should be by accept state. 4. 5 Give a context-free grammar for the set (abc il j or j -k) ie, the set of strings of a's followed by b's followed by c's, such that there are either a...
Question 4 (a) If = {0,1,2}. What is »?? What is the cardinality of 54? (b) Build a finite automaton that accepts every binary string that contains 101. (c) Write a regular expression for the language of all binary words that does not contain ab. (d) What is the language of the following regular expression b*a*b*a* ? Give three words that are and three words that are not in this language. (e) Give a context-free grammar G such that L(G)...