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
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.
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
a) What is alphanumeric information? >>> b) Explain how many bytes it will take to transmit...
a) What is alphanumeric information? >>> b) Explain how many bytes it will take to transmit “Go team” without the quotation marks. >>> c) Explain how many bytes it will take to transmit “Hello World!” without the quotation marks. >>> d) Go to a search engine and find a converter to represent characters in ASCII. What are the 7-bit ASCII codes for “Hello world!” without the quotation marks? (Check: H is 1001000.) Show this in a table with two columns....
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)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT