Question

In: Computer Science

Theory of computation: Consider the alphanumeric alphabet Σ = {a, b, . . . , z,...

Theory of computation:

Consider the alphanumeric alphabet Σ = {a, b, . . . , z, A, B, . . . , Z, 0, 1, . . . , 9} and let L be the language of all regular expressions over Σ:

L = {w ∈ Σ ∪ {∅,(,), ∪, ·, * }* | w is a syntactically legal regular expression over Σ}

Give an unambiguous context-free grammar that generates L. The grammar should use the following precedence levels, from highest to lowest:

(1) * (Kleene star) – highest precedence

(2) · (concatenation)

(3) ∪ (union) – lowest precedence

Solutions

Expert Solution

the context free language is defined by a context free grammar represented in the form of a 4-tuple (V, T, P, S) where

V = set of non terminal symbols

T = set of terminal symbols

P = set of production rules

S = starting symbol

the higher the precedence, the later it comes in the production

for example

S is starting symbol

so we start with the operator of lowest precedence i.e. union

then in the next rule we take up concatenation

and at the end we take up kleene star because of highest precedence

this is done because whenever an expression is given, if we think logically first the highest precedence operation is performed which means first the production corresponding to the highest precedence operator is used to reduce the expression in bottom up approach


Related Solutions

3. Are the following languages A and B over the alphabet Σ = {a, b, c,...
3. Are the following languages A and B over the alphabet Σ = {a, b, c, d} regular or nonregular? • For a language that is regular, give a regular expression that defines it. • For a nonregular language, using the pumping lemma prove that it is not regular. (a) A = {d 2j+1c k+1 | j ≥ k ≥ 0} · {c r+2b 2s+3 | r ≥ 0 and s ≥ 0} (b) B = {a 2j+2b k+3c j+1...
1. All questions assume the alphabet Σ = { a , b }. a) Give a...
1. All questions assume the alphabet Σ = { a , b }. a) Give a regular expression representing the language of all strings containing abab as a substring. b) Give a regular expression representing the language of all strings with an even number of a's or an odd number of b's, such as abab or baabaab. c) Give a regular expression representing the language of all strings of the form ambn, where m is even and n is odd....
Draft a program that scans an alphanumeric array to determine the first alphabet in the array.  If...
Draft a program that scans an alphanumeric array to determine the first alphabet in the array.  If found, the program should print “alphabet found” its value and index.  If no alphabet is found, the program should print “no alphabet found.” Submit the asm/list file and screenshots that show the output of your code for the following example arrays: a. Array has only alphabets b. Array has only numerals c. Several arrays with a mix of alphabets and numerals positioned at different indices
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L...
1. Prove the language L is not regular, over the alphabet Σ = {a, b}. L = { aib2i : i > 0} 2) Prove the language M is not regular, over the alphabet Σ = {a, b}. M = { wwR : w is an element of Σ* i.e. w is any string, and wR means the string w written in reverse}. In other words, language M is even-length palindromes.
2. Let S be the set of strings over the alphabet Σ = {a, b, c}...
2. Let S be the set of strings over the alphabet Σ = {a, b, c} defined recursively by (1) λ ∈ S and a ∈ S; and (2) if x ∈ S, then bxc ∈ S. Recall that λ denotes the empty string which has no letters and has length 0. List all strings of S which are length at most seven. 3. Prove the following theorem by induction: For every integer n ≥ 1, 1 · 2 +...
Automata Question. Over the alphabet Σ = {a, b}: 1) Give a DFA, M1, that accepts...
Automata Question. Over the alphabet Σ = {a, b}: 1) Give a DFA, M1, that accepts a Language L1 = { w | w has exactly 2 a’s } 2) Give a DFA, M2, that accepts a Language L2 = { w | w has at least 2 b’s } 3) Give acceptor for L1 intersection L2 4) Give acceptor for L1 - L2
Consider the language L1 over alphabet Σ = { 0, 1 } where the production rules...
Consider the language L1 over alphabet Σ = { 0, 1 } where the production rules for L1 are as follows: S → TT S → U T → 0T T → T0 T→ 1 U → 0U00 U → 1 Q → λ P → QU Transform this grammar into Chomsky Normal Form, consistent with the CNF specification in the Quick Reference, and using only Variables { S, T, U, V, W, X }. Implement that CNF grammar in...
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is...
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is finite? How many such languages exist?
English Alphabet (A..Z) are represented numerically by (0..25), e.g. A is 0, B is 1, etc....
English Alphabet (A..Z) are represented numerically by (0..25), e.g. A is 0, B is 1, etc. Use Caesar’s Cipher to encrypt the message HELLO WORLD with the Key being 4.
Consider a normal population with μ = 40 and σ = 4.2. Calculate the z-score for...
Consider a normal population with μ = 40 and σ = 4.2. Calculate the z-score for an x of 49 from a sample of size 15. (Give your answer correct to two decimal places
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT