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...
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
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
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
Information theory Consider a random variable representing coin throws (Bernoulli Variable with Σ = {0,1} )....
Information theory Consider a random variable representing coin throws (Bernoulli Variable with Σ = {0,1} ). Let the true probability distribution be p(0) = r, p(1) = 1-r. Someone guesses a different distribution q(0) = s, q(1) = 1-s. (a) Find expressions for the Kullback–Leibler distances D(p||q) and D(q||p) between the two distributions in terms of r and s. (b) Show that in general, D(p||q) ≠ D(q||p) and that equality occurs iff r = s. (c) Compute D(p||q) and D(q||p)...
Suppose A = {(a, b)| a, b ∈ Z} = Z × Z. Let R be...
Suppose A = {(a, b)| a, b ∈ Z} = Z × Z. Let R be the relation define on A where (a, b)R(c, d) means that 2 a + d = b + 2 c. a. Prove that R is an equivalence relation. b. Find the equivalence classes [(−1, 1)] and [(−4, −2)].
Consider the standard normal curve, where μ=0 and σ=1. Find the value z so that 90%...
Consider the standard normal curve, where μ=0 and σ=1. Find the value z so that 90% of the area under the curve is between −z and z . Give your answer to 4 decimal places.
Let Z[ √ 2] = {a + b √ 2 | a, b ∈ Z}. (a)...
Let Z[ √ 2] = {a + b √ 2 | a, b ∈ Z}. (a) Prove that Z[ √ 2] is a subring of R. (b) Find a unit in Z[ √ 2] that is different than 1 or −1.
consider the relation where each elements of the domain are the vowels of the alphabet. If...
consider the relation where each elements of the domain are the vowels of the alphabet. If the elements of the range are all the elements of the subset of {P,Q,R} and each domain element is associated with an image, can this relation be a function? Can it be one to one, justify your answer.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT