1 / 10

Topics

Alphabet and Strings. Topics. Strings over alphabet Language Generation Example Languages Language Generation by Concatenation Example Grammars From Grammar to Language. We first add  to  * .

wilda
Download Presentation

Topics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Alphabet and Strings Topics • Strings over alphabet • Language Generation • Example Languages • Language Generation by Concatenation • Example Grammars • From Grammar to Language

  2. We first add  to *. Then successively add strings of length 1, 2, 3, … , m, … and so on. We represent this process by the mathematical expression: * = 01 … m … which can be written as m Strings Over Alphabet Let  be a non-empty set of symbols, called alphabet. A string is a finite sequences of symbols taken from . The set of all strings over  is denoted by *. The null string is denoted by . Inductive Constructing of

  3. Def: A language overis a subset of*. Language Generation * is a countable (infinite) set. Let  = {0, 1}, construct *. * = {, row # 1 0, 1row # 2 00, 01, 10, 11, row # 3 000, 001, 010, 011, 100, 101, 110, 111 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111 … … } With exception of the first row, elements in the current row are obtained by right-appending 0 and 1 respectively to each element in the previous row. Some of the languages over {0, 1} are: a language with no words in it! {}a language with one word in it, which can be neither written or pronounced!

  4. Combining Languages Since languages are sets of strings, they can be combined by using operations of , ,  (set-theoretic difference), compliment, and other set operations. We can also produce a new language by concatenating strings from two other languages. A language obtained like this is called the concatenation of the two languages. If L and M are two languages over alphabets A and B respectively, then LM = {ab : a L and b  M}, with C = A  B as its alphabet. Example Languages {1, 11, 101, 111, 1001, …} all odd binary integers {0, 10, 100, 110, 1000, …} all even binary integers {0000, 0011, 0101, 0110, 1001, 1010, 1100, 1111} all 4-bit binary integers with even parity. A set of binary integers of a given length is said to have an even parity if it contains even number of 1’s.

  5. Language Generation by Concatenation: Examples A = {a, b, c} the alphabet for languages L and M. L = {ab, ac} and M = {a, bc, abc}, find (i) LM (ii)ML Solution: (i) LM = {aba, abbc, ababc, aca, acbc, acabc} (ii) ML = {aab, aac, bcab, bcac, abcab, abcac} Exercise: Find the value of L that satisfies the equation. {, a, ab}L = {b, ab, ba, aba, abb, abba} L = {b, ab}satisfies the equation.

  6. Example Grammars Grammars Language Grammar to generate it S  aS S  {ai : i 0} {b2j+1 : j 0} S  bbS S b

  7. Example Grammars – Continued … Language Grammar S  aSc S b {ajbcj : j 0} S  aBc B bB B  {abjc : j 0}

  8. S  aSA A  b 3 1 B  c S  aB 4 2 If you start with production then the only choice you have is to use to obtain the string ac, which is the smallest word in this language. 2 4 S aaaaacbbbb From Grammar to Language Example 3: Let T = {a, b, c}, V = {S, A, B} and let the productions be S aSA aaSAA aB aaBA aaaBAA ac aacA aaacAA aacb aaacbb

  9. Even and Odd Parities A set of binary integers of a given length is said to have an even parity if it contains even number of 1s. A set of binary integers of a given length is said to have an odd parity if it contains odd number of 1s.

  10. Definition of Grammar A grammar G is defined as a quadruple ( four things) G = (V, T, S, P), where V is a finite set of variable (also called non-terminals), T is a finite set of terminalsymbols, S  V is a special symbol called the start symbol, P is a set of productions. The sets V and T are non-empty and V  T = Φ. That is, V and T have no elements in common. Go Back

More Related