- Related Questions & Answers
- What are the different operations performed on strings in TOC?
- What are the different operations on files in C language?
- Explain the Character operations in C language
- Different Operations on Processes
- Explain the different sections in C language
- Explain the characteristics and operations of arrays in C language
- Explain Arithmetic operations using pointers in C language?
- Explain the concept of derivation in TOC
- How to perform the arithmetic operations on arrays in C language?
- Explain the power of an alphabet in TOC.
- Explain Deterministic Finite Automata in TOC.
- Explain the concept of state elimination method in TOC
- What are different pointer operations and problems with pointers in C language?
- Explain Non-Deterministic Finite Automata in TOC.
- What are the shift operations in C language?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

A language is a set of strings from some alphabet (finite or infinite). In other words, any subset L of E* is a language in TOC.

Some **special languages** are as follows −

- {} The empty set/language, containing no string.
- {s} A language containing one string, the empty string.

E = {0, 1}

L = {x | x is in E* and x contains an even number of 0’s}

E = {0, 1, 2,., 9, .}

L = {x | x is in E* and x forms a finite length real number}

= {0, 1.5, 9.326,.}

E = {a, b, c,., z, A, B,., Z}

L = {x | x is in E* and x is a Pascal reserved word}

= {BEGIN, END, IF,...}

E = {Pascal reserved words} U { (, ), ., :, ;,...} U {Legal Pascal identifiers}

L = {x | x is in E* and x is a syntactically correct Pascal program}

E = {English words}

L = {x | x is in E* and x is a syntactically correct English sentence}

Some of the operations on regular languages are as follows −

- Union
- Intersection
- Difference
- Concatenation
- kleen * closure

Let us understand these operations one by one.

If Ll and If L2 are two regular languages, their union Ll u L2 will also be regular.

For example, Ll = {an I n > O} and L2 = {bn I n > O}

L3 = Ll U L2 = {an U bn I n > O} is also regular.

If Ll and If L2 are two regular languages, their intersection Ll n L2 will also be regular.

**For example,**

Ll= {am bn I n > 0 and m > O} and

L2= {am bn U bn am I n > 0 and m > O}

L3 = Ll n L2 = {am bn I n > 0 and m > O} is also regular.

If Ll and If L2 are two regular languages, their concatenation L1.L2 will also be regular.

**For example,**

Ll = {an I n > 0} and L2 = {bn I n > O}

L3 = L1.L2 = {am . bn I m > 0 and n > O} is also regular.

If Ll is a regular language, its Kleene closure Ll* will also be regular.

For example, Ll = (a U b ), Ll* = (a U b)*

If L(G) is a regular language, its complement L'(G) will also be regular. Complement of a language can be found by subtracting strings which are in L(G) from all possible strings.

**For example,**

L(G) = {an I n > 3}

L'(G) = {an I n <= 3}

Note: Two regular expressions are equivalent, if languages generated by them are the same. For example, (a+b*)* and (a+b)* generate the same language. Every string which is generated by (a+b*)* is also generated by (a+b)* and vice versa .

Write the regular expression for the language accepting all combinations of a's, over the set l: = {a}

All combinations of a's mean a may be zero, single, double and so on. If a is appearing zero times, that means a null string. That is, we expect the set of {E, a, aa, aaa, ....}.

So we give a regular expression for this as follows −

R = a*

That is Kleen closure of a.

Advertisements