Скачать презентацию LANGUAGE CONCEPTS FORMAL MODEL FOR LANGUAGES Theory of Скачать презентацию LANGUAGE CONCEPTS FORMAL MODEL FOR LANGUAGES Theory of

1a9af54e1b81b026087dcbce8283e9cf.ppt

  • Количество слайдов: 13

LANGUAGE CONCEPTS: FORMAL MODEL FOR LANGUAGES Theory of Computer Akram Salah LANGUAGE CONCEPTS: FORMAL MODEL FOR LANGUAGES Theory of Computer Akram Salah

LANGUAGE CONCEPTS Language is a set of words, each word is a string of LANGUAGE CONCEPTS 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

LANGUAGE CONCEPTS S: a set of primitives, called alphabet Fundamental components Fundamental units L LANGUAGE CONCEPTS S: a set of primitives, called alphabet Fundamental components Fundamental units L : a set of strings, called words L = {w | w is a string from S} 3

LANGUAGE CONCEPTS L is called null, it is an empty string A string that LANGUAGE CONCEPTS L 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 L. A language, a set of words, is finite. A language can not be infinite. 4

LANGUAGE CONCEPTS If S ={x}, we can define Closure of S is a language LANGUAGE CONCEPTS If S ={x}, we can define Closure of S is a language contains all possible strings (whether they are meaningful or not) L = {x, xxx, xxxx, …. } If we want to include the null L to the closure of S, we denote it as S* 5

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

LANGUAGE CONCEPTS The English alphabet, S= {a, b, c, …, z} English, L = LANGUAGE CONCEPTS The English alphabet, S= {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 S= { }ﺍ, ﺏ, ﺕ, . . . , ﻱ L = {. . , }ﻗﻂ , ﻛﻠﺐ, ﻛﺘﺎﺏ, ﻭﻟﺪ, ﺣﺎﺳﺐ, ﺑﺮﻧﺎﻣﺞ 7

LANGUAGE CONCEPTS G = { English words (in the dictionary) plus all punctuation marks} LANGUAGE CONCEPTS G = { English words (in the dictionary) plus all punctuation marks} G = {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 G. 8

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

LANGUAGE CONCEPTS Word functions Concatenate: w 1 w 2 w 1 = boat, w LANGUAGE CONCEPTS 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

LANGUAGE CONCEPTS Length, returns the number of characters in a word w 1 = LANGUAGE CONCEPTS Length, returns the number of characters in a word w 1 = cat w 2 = computer length(w 1) = 3 length(w 2) = 7 11

LANGUAGE CONCEPTS reverse: returns a string contains the same letters in w in a LANGUAGE CONCEPTS 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

LANGUAGE CONCEPTS Length(w 1 w 2) = length(w 1) + length(w 2) Length(w 1) LANGUAGE CONCEPTS 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