Presentation is loading. Please wait.

Presentation is loading. Please wait.

L ANGUAGE C ONCEPTS : F ORMAL M ODEL FOR L ANGUAGES Theory of Computer Akram Salah.

Similar presentations


Presentation on theme: "L ANGUAGE C ONCEPTS : F ORMAL M ODEL FOR L ANGUAGES Theory of Computer Akram Salah."— Presentation transcript:

1 L ANGUAGE C ONCEPTS : F ORMAL M ODEL FOR L ANGUAGES Theory of Computer Akram Salah

2 L ANGUAGE C ONCEPTS Language is a set of words, each word is a string of characters, each character is an element in the language alphabet. A language is defined over an alphabet, a set of elementary units. The most basic units of a language is its alphabet. 2

3 L ANGUAGE C ONCEPTS  : a set of primitives, called alphabet Fundamental components Fundamental units L : a set of strings, called words L = {w | w is a string from  } 3

4 L ANGUAGE C ONCEPTS  is called null, it is an empty string A string that has no characters An alphabet cannot be empty A language, L, set of words, may have as an element . A language, a set of words, is finite. A language can not be infinite. 4

5 L ANGUAGE C ONCEPTS If  ={x}, we can define Closure of  is a language contains all possible strings (whether they are meaningful or not) L = {x, xx, xxx, xxxx, ….} If we want to include the null  to the closure of  we denote it as  * 5

6 L ANGUAGE C ONCEPTS  = {a, b, c}  * = { , a, b, c, aa, ab, ac, ba, bb, ca, cb, cc, aaa, …..} If S = {aa, b} S* = {  plus any word composed of factors of aa and b} = { , b, aa, bb, aab, baa, aaa, aaaa, aabb, …} S + = closure without  = {b, aa, bb, aab, baa, aaa, aaaa, aabb, …} 6

7 L ANGUAGE C ONCEPTS The English alphabet,  = {a, b, c, …, z} English, L = {cat, dog, book, boy, computer, program, …} Those are the words in English dictionary. The dictionary must be finite The عربي alphabet  = { ا, ب, ت,..., ي } L = { قط, كلب, كتاب, ولد, حاسب, برنامج,.... } 7

8 L ANGUAGE C ONCEPTS  = { English words (in the dictionary) plus all punctuation marks}  = {L U {“ “, :, ;, (, ), -,,,, …}} We can construct I ate one apple. I went to school. He called Aly, his uncle. Sentences are series (concatenation) of elements of  8

9 L ANGUAGE C ONCEPTS  = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} A finite set of digits L = {23, 180, 4427,..} A set of numbers Think (assignment) Define a language of phone numbers. Define a language of car license numbers. 9

10 L ANGUAGE C ONCEPTS Word functions Concatenate: w 1 w 2 w 1 = boat, w 2 = house w 3 = w 1 w 2 = boathouse w 4 = w 2 w 1 = houseboat 10

11 L ANGUAGE C ONCEPTS Length, returns the number of characters in a word w 1 = cat w 2 = computer length(w 1 ) = 3 length(w 2 ) = 7 11

12 L ANGUAGE C ONCEPTS reverse: returns a string contains the same letters in w in a reversed order. w 1 = cat w 2 = computer w 3 = 7641 reverse(w 1 ) = tac reverse(w 2 ) = retupmoc reverse(w 3 ) = 1467 12

13 L ANGUAGE C ONCEPTS Length(w 1 w 2 ) = length(w 1 ) + length(w 2 ) Length(w 1 ) = length(reverse(w 1 )) Reverse(w 1 w 2 ) =/= w 2 w 1 13


Download ppt "L ANGUAGE C ONCEPTS : F ORMAL M ODEL FOR L ANGUAGES Theory of Computer Akram Salah."

Similar presentations


Ads by Google