1. Regular expressions describe regular languages using combinations of symbols and operators like union, concatenation, and multiplicity.
2. A regular grammar is one where each production contains at most one variable on the right side. It can be right-linear or left-linear.
3. Regular languages are closed under operations like union, intersection, concatenation, complement, star, difference, reversal, homomorphism, and right quotient. Homomorphism involves substituting single letters with strings.
1. Regular expressions describe regular languages using combinations of symbols and operators like union, concatenation, and multiplicity.
2. A regular grammar is one where each production contains at most one variable on the right side. It can be right-linear or left-linear.
3. Regular languages are closed under operations like union, intersection, concatenation, complement, star, difference, reversal, homomorphism, and right quotient. Homomorphism involves substituting single letters with strings.
1. Regular expressions describe regular languages using combinations of symbols and operators like union, concatenation, and multiplicity.
2. A regular grammar is one where each production contains at most one variable on the right side. It can be right-linear or left-linear.
3. Regular languages are closed under operations like union, intersection, concatenation, complement, star, difference, reversal, homomorphism, and right quotient. Homomorphism involves substituting single letters with strings.
Regular Expressions Regular expressions describe regular languages using different notations. Notations are combinations of strings of symbols from: 1. Some alphabet Σ 2. Parentheses ( and ) 3. Operators: a. + : union b. : concatenation c. * : multiplicity (occurrence of a symbol zero or more times) Primitive regular expressions 1. : denotes empty set 2. Λ: denotes {λ} 3. aϵ Σ: denotes denotes {a} If r1 and r2 are regular expressions, then are also regular expressions. Language associated with regular expression Language Regular Expression L(r1 + r2) L(r1)Ս L(r2) L(r1 r2) L(r1) L(r2) L(r1*) (L(r1))* L((r1)) L(r1)
Language denoted by regular expression
Language Regular Expression {a,b,c} a+b+c {a}Ս{bc} a+(bc) {a,bc}* (a+(bc))*
Generalized Transition Graph
A generalized transition graph is a transition graph whose edges are labeled with regular expressions. Any transition graph is reduced to two-state transition graph shown in Figure 3.1 and the regular expression for the same is derived as r1*r2(r3+r4 r1*r2)* Figure 3.1 Regular Grammars Regular grammar is another way of representing the regular language. In a regular grammar at most one variable appears on the right side of the production. It is either right-linear or left-linear. A grammar G=(V, T, S, P) is said to be linear grammar if all the productions contain at most one variable on the right side of the production, without restriction on the position of the variable. A grammar G=(V, T, S, P) is said to be right-linear if all the productions are of the form AxB or Ax, where A, Bϵ V and xϵT*. A grammar G=(V, T, S, P) is said to be left-linear if all the productions are of the form ABx or Ax, where A, Bϵ V and xϵT*.
PROPERTIES OF REGULAR LANGUAGES
If L1 and L2 are regular languages, then so are 1. Union: L1 Ս L2 2. Intersection: L1 ∩ L2 3. Concatenation: L1L2 4. Complement: Ĺ1 5. Star: : L1* 6. Difference: L1- L2 7. Reversal: L1R 8. Homomorphism: 9. Right quotient Homomorphism Homomorphism is a substitution in which a single letter is replaced with a string. Suppose Σ and Γ are alphabets, then a function h : Σ Γ* is called a homomorphism. If w=a1a2….an then h(w)= h(a1)h(a2)….h(an). If L is a language on Σ, then its homomorphic image is defined as h(L)= {h(w) : w ϵ L}. Right Quotient Let L1 and L2 be languages on the same alphabet, then the right quotient of L1 and L2 is defined as L1/L2= {x : xy ϵ L1 for some y ϵ L2 } Identifying nonregular languages A pumping lemma is a method to show that a given language is not regular i.e., it is used to identify nonregular languages. Given an infinite regular language L there exists an integer m such that for any string w ϵ L with length |w|≥m can be decomposed as w=xyz with |xy|≤m and |y|≥1 such that w i=xyiz ϵ L for all i=0, 1, 2, ….
CONTEXT FREE LANGUAGES
Context free grammar A grammar G=(V, T, S, P) is said to be context free if all productions in P have the form Ax, where A ϵ V and x ϵ (V Ս T)*. A language L is said to be context free if and only if there is a context free grammar G such that L= L(G). Leftmost and Rightmost derivations A derivation is said to be leftmost if in each step the leftmost variable in the sentential form is replaced. If in each step the rightmost variable is replaced, then the derivation is called rightmost derivation. Derivation Trees A derivation tree is an ordered tree in which the nodes are labeled with the left sides of the production and in which the children of a node represent its corresponding right side. Ambiguity A context free grammar is said to be ambiguous if there exist some w ϵ L(G) if there exists either two or more derivation trees or two or more leftmost derivations or two or more rightmost derivations.