CHAPTER TWO LANGUAGES. Dr Zalmiyah Zakaria

Size: px
Start display at page:

Download "CHAPTER TWO LANGUAGES. Dr Zalmiyah Zakaria"

Transcription

1 CHAPTER TWO LANGUAGES By Dr Zalmiyah Zakaria

2 Languages Contents: 1. Strings and Languages 2. Finite Specification of Languages 3. Regular Sets and Expressions Sept2011 Theory of Computer Science 2

3 Strings and Languages Natural languages, computer languages, mathematical languages A language is a set of strings over an alphabet. Syntax of the language: certain properties that must be satisfied by strings. Sept2011 Theory of Computer Science 3

4 Strings and Alphabets Symbols / Letters / Characters A single element of the alphabets that has a unique meaning, i.e.: symbol A and B which have different meanings. Alphabet (denoted by in italic capital letters) A finite set of symbols indivisible objects. String / Word A finite sequence of symbols from alphabets. 4

5 Strings and Alphabets E.g.: C = {a, b, c, 1, 2, 3} Alphabet C with 6 units of symbols An example of a word / string from the alphabet C : acca, baca, 132, a12, etc. String acca and caac have different meanings. String acca, 121, abba are palindromes. 5

6 Strings and Alphabets (cont.) Important : Strings of characters are fundamental building blocks in computer science. Sept2011 Theory of Computer Science 7

7 Strings and Alphabets (cont.) String over an alphabet is a finite sequence of symbols from that alphabet, written next to one another and not separated by commas. E.g.: Let = {0,1}, then strings over are: 0, 1, 00, 01, 10, 11, 1010, , , and etc. Sept2011 Theory of Computer Science 8

8 Length of String If w is a string over, the length of w, written w, is the number of symbols that it contains. E.g.: λ = 0 0 = 1 1 = = = 6 Sept2011 Theory of Computer Science 10

9 Length of String (cont.) The set of strings, * = {a, b, c} includes: length 0: length 1: length 2: length 3: λ a b c aa ab ac ba bb bc ca cb cc aaa aab aac aba abb abc aca acb acc baa bab bac bba bbb bbc bca bcb bcc caa cab cac cba cbb cbc cca ccb ccc Sept2011 Theory of Computer Science 11

10 Concatenation of String If we have string x of length m and string y of length n, the concatenation of x and y written xy is x 1 x m y 1 y n. E.g.: Then x = aba y = bbbab xy = ababbbab yx = bbbababa xyx = ababbbababa Sept2011 Theory of Computer Science 12

11 Self Concatenation If we have string x, the concatenation of x and x is self concatenation E.g.: x 0 x 1 = x x 2 = xx x 3 = xxx = = aba = abaaba = abaabaaba x k = xx x : self-concatenated string k times Sept2011 Theory of Computer Science 13

12 Concatenation Let u = ab, v = ca, w = bb. Then the concatenation of: uv = abca vw = cabb (uv)w = abcabb u(vw) = abcabb The result is independent of the order in which the operations are performed. Sept2011 Theory of Computer Science 15

13 Substring String z is a substring of w if z appears consecutively within w (z occurs inside of w) Thus, substring is a subset of the symbols in a string. E.g.: w = abbaaababb bba is a substring of w abab is a substring of w baba is NOT a substring of w Sept2011 Theory of Computer Science 16

14 Prefix Prefix for string v is a substring u where : if x =, for = xuy Then = uy (string v starts with substring u) A prefix can be seen as a special case of a substring. E.g.: if w = abbaaababb a is a prefix of w abbaa is a prefix of w bba is NOT a prefix of w Sept 2011 Theory of Computer Science 17

15 Suffix Suffix for string v is a substring u where : if y =, for = xuy Then = xu (string v ends with substring u) A suffix also can be seen as a special case of a substring. E.g.: if w = abbaaababb abb is a suffix of w babb is a suffix of w bab is NOT a suffix of w Sept2011 Theory of Computer Science 18

16 Reverse The reverse of w, written w R or w r is the string obtained by writing w in the opposite order. E.g.: if w = a w R = a if w = abb w R = bba if w = aba w R = aba if w = abbcd w R = dcbba Sept2011 Theory of Computer Science 19

17 Finite Spec. of Languages Languages can be defined using 2 ways: either presented as an alphabet and the exhaustive list of all valid words an alphabet and a set of rules defining the acceptable words. Sept2011 Theory of Computer Science 22

18 PALINDROME language E.g.: definition of a new language PALINDROME over the alphabet : = a b PALINDROME =, and all string x such that reverse(x) = x Sept2011 Theory of Computer Science 23

19 PALINDROME Listing : PALINDROME = a b aa bb aaa aba bab bbb aaaa abba If we concatenate 2 words in PALINDROME, sometimes it can produce a new words which is also in PALINDROME but sometimes it doesn t. Sept2011 Theory of Computer Science 24

20 Kleene Closure / Star Σ* is the collection of all possible finitelength strings generated from the strings in Σ. The definition of Kleene star on Σ is Sept2011 Theory of Computer Science 25

21 Kleene Closure / Star E.g.: if = x, then * = x * = x xx xxx if = 0 1, then * = Applied to set of strings: {ab, c}* = {λ, ab, c, abab, abc, cab, cc, ababab, ababc, abcab, abcc, cabab, cabc, ccab, ccc,...} Sept2011 Theory of Computer Science 26

22 Kleene Closure / Star Applied to set of characters: {a, b, c}* = {λ, a, b, c, aa, ab, ac, ba, bb, bc, ca, cb, cc,...}. Kleene star applied to the empty set: Sept2011 Theory of Computer Science 27

23 Kleene star (cont.) We can think of the Kleene star as an operation that makes an infinite language of strings of letter out of an alphabet. Infinite language = infinitely many words, each of finite length. Sept2011 Theory of Computer Science 28

24 Definition of S* If S is a set of words, then by S* Means the set of all finite strings formed by concatenating words from S, where any word may be used as often as we like, and where the null string is also included. Sept2011 Theory of Computer Science 29

25 If S = {aa b}, then Example S* = {λ plus any word composed of factors of aa and b} = {λ plus all strings of a s and b s in which the a s occur in even clumps} = {λ b aa bb aab baa bbb } Sept2011 Theory of Computer Science 30

26 Example S* = {aa b}*, where * = 0, 1, 2, 3, {aa b} 0 = {λ} {aa b} 1 = {aa b} {aa b} 2 = {aa b} {aa b} = {aaaa aab baa bb} {aa b} 3 = {aa b} {aa b} {aa b} = {aaaaaa aaaab aabaa aabb baaaa baab bbaa bbb} {aa b} 4 = {aa b} {aa b} {aa b} {aa b} = {aaaaaaaa aaaaaab aaaabaa aaaabb aabaaaa aabaab aabbaa aabbb baaaaaa baaaab baabaa baabb bbaaaa bbaab bbbaa bbbb}.. Sept2011 Theory of Computer Science 31

27 Example If S = {a ab}, then S* = {λ plus any word composed of factors of a and ab} = {λ plus all strings of a s and b s except those that start with b and those that contain a double b} = {λ a aa ab aaa aab aba } Sept2011 Theory of Computer Science 32

28 Kleene Plus / Positive closure + If we would like to refer to only the concatenation of some (not zero) strings from a set S, we use the notation + instead of *, E.g.: if = x, then + = x xx xxx Kleene plus applied to the empty set: Sept2011 Theory of Computer Science 34

29 S + if S is a set of strings not include λ, then S + is the language S* without the word λ. If S is a language that does contain λ, then S + = S*. S + can contain λ only when S contains the word initially. Sept2011 Theory of Computer Science 35

30 S* and S** Theorem 1: for any set S of strings we have S* = S** Proof: every word in S** is made up of factors from S*. Every factor from S* is made up of factors from S. Therefore, every word in S** is made up of factors from S. Therefore, every word in S** is also a word in S*. S** S* (is contained in or equal to) Sept2011 Theory of Computer Science 36

31 Regular Expressions Rules that define exactly the set of words that are valid in a formal language. Sept2011 Theory of Computer Science 38

32 Regular Expressions Formally, the set of regular expressions can be defined by the following recursive rules: 1. Every symbol of is a regular expression 2. ε is a regular expression 3. if R1 and R2 are regular expressions, so are (R1) R1R2 R1 R2 R1* 4. Nothing else is a regular expression. Sept2011 Theory of Computer Science 39

33 Regular Expressions Regular expressions are defined recursively a) Base case simple regular expressions b) Recursive case how to build more complex regular expressions from simple regular expressions Sept2011 Theory of Computer Science 40

34 Formal definition of regular expressions A language is regular if it can be described by a regular expression. The Regular Languages is the set of all languages that can be represented by a regular expression Set of set of strings Not every languages are able to be described by RE. Regular languages may also be described by another fine definitions, besides the RE. Sept2011 Theory of Computer Science 41

35 Regular Expression The symbols that appear in RE are the letters of the alphabet the symbol of null string or λ parentheses ( ) star operator * or + sign Sept2011 Theory of Computer Science 42

36 Regular Expressions (((a + b)(b*)) a) ((a ((a + b)*)) a) ((a*)(b*)) ((ab)*) Sept2011 Theory of Computer Science 43

37 Regular Expressions (((a + b)(b*)) a) {aa, ba, aba, bba, abba, bbba, abbba, bbbba,...} ((a ((a + b)*)) a) {aa, aaa, aba, aaaa, aaba, abaa, abba,...} ((a*)(b*)) {, a, b, aa, ab, bb, aaa, aab, abb, bbb,...} ((ab)*) {, ab, abab, ababab, abababab,...} Sept2011 Theory of Computer Science 44

38 IN or NOT IN? ab* IN a, ab, abb, abb, abbbb, NOT IN b, ba, aba, abab, bab, bbb, aab, baa, abba (ab)* IN, ab, abab, ababab, abababab, NOT IN b, ba, bb, abb, baa, bba, bab, bbb (a*b*) IN, a, b, aa, ab, bb, aaa, aab, abb, bbb, aaaa NOT IN ba, bab, abab, bba, aba, bbba Sept2011 Theory of Computer Science 45

39 Regular Expressions All strings over {a, b} that start with an a a (a + b)* All strings over {a, b} that are even in length ((a + b) (a + b))* All strings over {0, 1} that have an even number of 1 s. 0*(10*10*)* All strings over {a, b} that start and end with the same letter a(a + b)*a + b(a + b)*b + a + b Sept2011 Theory of Computer Science 46

40 Regular Expressions All strings over {0, 1} with no occurrences of 00 1*(011*)*(0+1*) All strings over {0, 1} with exactly one occurrence of 00 1*(011*)*00(11*0)*1* All strings over {0, 1} that contain 101 (0+1)*101(0+1)* All strings over {0, 1} that do not contain 01 1*0* Sept2011 Theory of Computer Science 47

41 Regular Expressions We shall develop some new languagedefinition symbolism that will be much more precise than the E.g.: L 1 = x xx xxx xxxx We can define it with closure Let S = x Then L 1 = S* or we can write L 1 = x * Sept2011 Theory of Computer Science 48

42 Language(x*) We can also define L 2 as L 2 = (x*) Since x* is any string of x s, L 2 is then the set of all possible string of x s of any length (including λ) Sept2011 Theory of Computer Science 49

43 Example Suppose we wish to describe the language L over the alphabet = a b where L = a ab abb abbb abbbb all words of the form one a followed by some number of b s (maybe no b s at all) we may write L = (ab*) Sept2011 Theory of Computer Science 50

44 (ab)* (ab)* = or ab or abab or ababab Parentheses are not letters in the alphabet of this language, so they can be used to indicate factoring without accidentally changing the words. Like the powers in algebra ab* means a(b*), not (ab)* Sept2011 Theory of Computer Science 51

45 (xx*) vs. (x + ) means? L 1 = (xx*) We start each word of L 1 by writing down an x and then we follow it with some string of x s (which may be no more x s at all.) We can use the + notation and write L 1 = (x + ) Sept2011 Theory of Computer Science 52

46 L 1 = (xx*) and L 1 = (x + ) The language L 1 defined above can also be defined by any of these expressions: xx* x + xx*x* x*xx* Remember x + x* x*x + x*x*x*xx* x* can always be λ Sept2011 Theory of Computer Science 53

47 Example ab*a is the set of all string of a s and b s that have at least two letters, that begin and end with a s, and that have nothing but b s inside (if anything at all). (ab*a) = aa aba abba abbba abbbba Sept2011 Theory of Computer Science 54

48 Example a*b* contains all the strings of a s and b s in which all the a s (if any) come before all b s (if any) (a*b*) = a b aa ab bb aaa aab abb bbb aaaa notice that ba and aba are not in this language Sept2011 Theory of Computer Science 55

49 a*b* vs. (ab)* a*b* (ab)* (ab)* can contain abab but a*b* can t contain abab Sept2011 Theory of Computer Science 56

50 Regular Operations Let A and B be languages. We define the regular operations union, concatenation, and star as follows. Union : A B = {x x A or x B} Concatenation : (simply no written) A B = {xy x A and y B} Star : A* = {x 1 x 2 x 3 x k k 0 and each x i A} Sept2011 Theory of Computer Science 57

51 Union ( ) x y where x and y are strings of characters from an alphabet means either x or y Also written as x + y Sept2011 Theory of Computer Science 58

52 Example Consider the language T defined over the alphabet = a b c T = a c ab cb abb cbb abbb cbbb abbbb cbbbb all the words in T begin with an a or a c and then are followed by some number of b s. T = ((a c) b*) = (either a or c then some b s) Sept2011 Theory of Computer Science 59

53 Finite language L We can define any finite language by our new expression. E.g.: Consider a finite language L contains all the strings of a s and b s of length 3 exactly: L = aaa aab aba abb baa bab bba bbb The first letter can be either a or b. So do the 2nd and 3rd letter. L = ((a b) (a b) (a b)) Sept2011 Theory of Computer Science 60

54 Finite language (cont.) or we can simply write shortly as L = (a b) 3 if we write (a b)*, it means the set of all possible strings of letters from the alphabet = a b c including the null string λ Sept2011 Theory of Computer Science 61

55 If we write Examples a(a b)* we can describe all words that begin with the letter a. If we would like to describe all words that begin with an a and end with b, we can define by the expression a(a b)*b = a(arbitrary string)b Sept2011 Theory of Computer Science 62

56 Null Language or λ is the symbol of null string in regular expression. is the symbol for Null Language Don t confuse! R = λ represents the language containing a single string, the empty string. {λ} R = represents the language that doesn t contain any strings. Sept2011 Theory of Computer Science 63

57 Example Let consider the language defined by (a b)*a(a b)* What does it produce? The language of all words over the alphabet = {a, b} that have an a in somewhere. Only words which are not in this language are those that have only b s and the word. Sept2011 Theory of Computer Science 64

58 Union of two languages Those words which compose of only b s are defined by the expression b*. (b* also includes the null string ) Therefore, the language of all strings over the alphabet = {a, b} are all strings = (all strings with an a) (all string without an a) (a b)* = (a b)*a(a b)* b* Sept2011 Theory of Computer Science 65

59 Example How can we describe the language of all words that have at least two a s? Answer (a b)*a(a b)*a(a b)* = (some beginning)(the first a)(some middle)(the second a)(some end) where the arbitrary parts can have as many a s (or b s) as they want. Sept2011 Theory of Computer Science 66

60 Example Is there any other RE that can define the language with at least two a s? Answer: Yes. E.g.: b*ab*a(a b)* = (some beginning of b s (if any))(the first a) (some middle of b s)(the second a) (some end) Sept2011 Theory of Computer Science 67

61 Equivalent expressions (a b)*a (a b)*a (a b)* = b*ab*a(a b)* Both expressions are equivalent because they both describe the same item. We could write ((a b)*a (a b)*a (a b)*) = (b*ab*a(a b)*) = all words with at least two a s = (a b)*ab*ab* = b*a(a b)* ab* Sept2011 Theory of Computer Science 68

62 Example If we wanted all words with exactly two a s, we could use the expression b*ab*ab* it can describes such words as aab, baba, bbbabbbab, Question: Can it make the word aab? Answer : Yes, by having the first and second b* = λ Sept2011 Theory of Computer Science 69

63 Example How about the language with at least one a and at least one b? (a b)*a(a b)*b(a b)* It can only produce words which an a precede a b. To produce words which have a b precede an a, we can describe by (a b)*b(a b)*a(a b)* Thus, the set of all words : (a b)*a (a b)*b (a b)* (a b)*b (a b)*a (a b)* Sept2011 Theory of Computer Science 70

64 Example (a b)*a (a b)*b (a b)* can produce all words with at least one a and at least one b. However, it doesn t contain the words of the forms some b s followed by some a s. These exceptions are all defined by bb*aa* Thus, we have all strings over = {a, b} (a b)*a (a b)*b (a b)* (a b)*b (a b)*a (a b)* = (a b)*a (a b)*b (a b)* bb*aa* Sept2011 Theory of Computer Science 71

65 (a b)* (a b)*a (a b)*b (a b)* bb*aa* generates all words which have both a and b in them somewhere. Words which are not included in the above expression are words of all a s, all b s or a*, b* Now, we have all words which can be generated above the alphabet (a b)* = (a b)*a (a b)*b (a b)* bb*aa* a* b* Sept2011 Theory of Computer Science 72

66 Note that: Sets = { } { } Set size { } = = 0 Set size { } = 1 String length = 0 Sept2011 Theory of Computer Science 73

67 References Sept2011 Theory of Computer Science 75

Chapter 4: Regular Expressions

Chapter 4: Regular Expressions CSI 3104 /Winter 2011: Introduction to Formal Languages What are the languages with a finite representation? We start with a simple and interesting class of such languages. Dr. Nejib Zaguia CSI3104-W11

More information

Finite Automata Part Three

Finite Automata Part Three Finite Automata Part Three Recap from Last Time A language L is called a regular language if there exists a DFA D such that L( D) = L. NFAs An NFA is a Nondeterministic Finite Automaton Can have missing

More information

Finite Automata Part Three

Finite Automata Part Three Finite Automata Part Three Friday Four Square! Today at 4:15PM, Outside Gates. Announcements Problem Set 4 due right now. Problem Set 5 out, due next Friday, November 2. Play around with finite automata

More information

Glynda, the good witch of the North

Glynda, the good witch of the North Strings and Languages It is always best to start at the beginning -- Glynda, the good witch of the North What is a Language? A language is a set of strings made of of symbols from a given alphabet. An

More information

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81%

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% 1. (2 pts) See text. You can t be sloppy defining terms like this. You must show a bijection between the natural numbers

More information

Finite Automata Part Three

Finite Automata Part Three Finite Automata Part Three Recap from Last Time A language L is called a regular language if there exists a DFA D such that L( D) = L. NFAs An NFA is a Nondeterministic Finite Automaton Can have missing

More information

CMPSCI 250: Introduction to Computation. Lecture #28: Regular Expressions and Languages David Mix Barrington 2 April 2014

CMPSCI 250: Introduction to Computation. Lecture #28: Regular Expressions and Languages David Mix Barrington 2 April 2014 CMPSCI 250: Introduction to Computation Lecture #28: Regular Expressions and Languages David Mix Barrington 2 April 2014 Regular Expressions and Languages Regular Expressions The Formal Inductive Definition

More information

Notes for Comp 454 Week 2

Notes for Comp 454 Week 2 Notes for Comp 454 Week 2 This week we look at the material in chapters 3 and 4. Homework on Chapters 2, 3 and 4 is assigned (see end of notes). Answers to the homework problems are due by September 10th.

More information

Compiler Construction

Compiler Construction Compiler Construction Exercises 1 Review of some Topics in Formal Languages 1. (a) Prove that two words x, y commute (i.e., satisfy xy = yx) if and only if there exists a word w such that x = w m, y =

More information

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory Proof Techniques Alphabets, Strings, and Languages Foundations of Computer Science Theory Proof By Case Enumeration Sometimes the most straightforward way to prove that a property holds for all elements

More information

1.3 Functions and Equivalence Relations 1.4 Languages

1.3 Functions and Equivalence Relations 1.4 Languages CSC4510 AUTOMATA 1.3 Functions and Equivalence Relations 1.4 Languages Functions and Equivalence Relations f : A B means that f is a function from A to B To each element of A, one element of B is assigned

More information

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata Solved Subjective From Midterm Papers Dec 07,2012 MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 MIDTERM SPRING 2012 Q. Point of Kleen Theory. Answer:- (Page 25) 1. If a language can be accepted

More information

Chapter Seven: Regular Expressions

Chapter Seven: Regular Expressions Chapter Seven: Regular Expressions Regular Expressions We have seen that DFAs and NFAs have equal definitional power. It turns out that regular expressions also have exactly that same definitional power:

More information

Strings, Languages, and Regular Expressions

Strings, Languages, and Regular Expressions Strings, Languages, and Regular Expressions Strings An alphabet sets is simply a nonempty set of things. We will call these things symbols. A finite string of lengthnover an alphabets is a total function

More information

CS402 - Theory of Automata FAQs By

CS402 - Theory of Automata FAQs By CS402 - Theory of Automata FAQs By Define the main formula of Regular expressions? Define the back ground of regular expression? Regular expressions are a notation that you can think of similar to a programming

More information

Welcome! CSC445 Models Of Computation Dr. Lutz Hamel Tyler 251

Welcome! CSC445 Models Of Computation Dr. Lutz Hamel Tyler 251 Welcome! CSC445 Models Of Computation Dr. Lutz Hamel Tyler 251 hamel@cs.uri.edu https://fbeedle.com/content/formal-language-practical-introduction-0 The Course Text: Formal Language, by Adam Book Webber,

More information

Lesson 18: Counting Problems

Lesson 18: Counting Problems Student Outcomes Students solve counting problems related to computing percents. Lesson Notes Students will continue to apply their understanding of percent to solve counting problems. The problems in

More information

Assignment No.4 solution. Pumping Lemma Version I and II. Where m = n! (n-factorial) and n = 1, 2, 3

Assignment No.4 solution. Pumping Lemma Version I and II. Where m = n! (n-factorial) and n = 1, 2, 3 Assignment No.4 solution Question No.1 a. Suppose we have a language defined below, Pumping Lemma Version I and II a n b m Where m = n! (n-factorial) and n = 1, 2, 3 Some strings belonging to this language

More information

DVA337 HT17 - LECTURE 4. Languages and regular expressions

DVA337 HT17 - LECTURE 4. Languages and regular expressions DVA337 HT17 - LECTURE 4 Languages and regular expressions 1 SO FAR 2 TODAY Formal definition of languages in terms of strings Operations on strings and languages Definition of regular expressions Meaning

More information

KHALID PERVEZ (MBA+MCS) CHICHAWATNI

KHALID PERVEZ (MBA+MCS) CHICHAWATNI FAQ's about Lectures 1 to 5 QNo1.What is the difference between the strings and the words of a language? A string is any combination of the letters of an alphabet where as the words of a language are the

More information

Languages and Strings. Chapter 2

Languages and Strings. Chapter 2 Languages and Strings Chapter 2 Let's Look at Some Problems int alpha, beta; alpha = 3; beta = (2 + 5) / 10; (1) Lexical analysis: Scan the program and break it up into variable names, numbers, etc. (2)

More information

Regular Expressions. Lecture 10 Sections Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2016

Regular Expressions. Lecture 10 Sections Robb T. Koether. Hampden-Sydney College. Wed, Sep 14, 2016 Regular Expressions Lecture 10 Sections 3.1-3.2 Robb T. Koether Hampden-Sydney College Wed, Sep 14, 2016 Robb T. Koether (Hampden-Sydney College) Regular Expressions Wed, Sep 14, 2016 1 / 23 Outline 1

More information

JNTUWORLD. Code No: R

JNTUWORLD. Code No: R Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five

More information

Automata Theory CS S-FR Final Review

Automata Theory CS S-FR Final Review Automata Theory CS411-2015S-FR Final Review David Galles Department of Computer Science University of San Francisco FR-0: Sets & Functions Sets Membership: a?{a,b,c} a?{b,c} a?{b,{a,b,c},d} {a,b,c}?{b,{a,b,c},d}

More information

Lec-5-HW-1, TM basics

Lec-5-HW-1, TM basics Lec-5-HW-1, TM basics (Problem 0)-------------------- Design a Turing Machine (TM), T_sub, that does unary decrement by one. Assume a legal, initial tape consists of a contiguous set of cells, each containing

More information

Associative Operations on a Three-Element Set

Associative Operations on a Three-Element Set The Mathematics Enthusiast Volume 5 Number 2 Numbers 2 & 3 Article 9 7-2008 Associative Operations on a Three-Element Set Friðrik Diego Kristín Halla Jónsdóttir Let us know how access to this document

More information

Multiple Choice Questions

Multiple Choice Questions Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM

More information

Models and Algorithms for Complex Networks

Models and Algorithms for Complex Networks Models and Algorithms for Complex Networks with network with parametrization, elements maintaining typically characteristic local profiles with categorical attributes [C. Faloutsos MMDS8] Milena Mihail

More information

ITEC2620 Introduction to Data Structures

ITEC2620 Introduction to Data Structures ITEC2620 Introduction to Data Structures Lecture 9b Grammars I Overview How can a computer do Natural Language Processing? Grammar checking? Artificial Intelligence Represent knowledge so that brute force

More information

Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End

Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End Architecture of Compilers, Interpreters : Organization of Programming Languages ource Analyzer Optimizer Code Generator Context Free Grammars Intermediate Representation Front End Back End Compiler / Interpreter

More information

CMPSCI 250: Introduction to Computation. Lecture #36: State Elimination David Mix Barrington 23 April 2014

CMPSCI 250: Introduction to Computation. Lecture #36: State Elimination David Mix Barrington 23 April 2014 CMPSCI 250: Introduction to Computation Lecture #36: State Elimination David Mix Barrington 23 April 2014 State Elimination Kleene s Theorem Overview Another New Model: The r.e.-nfa Overview of the Construction

More information

CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters

CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters : Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Scanner Parser Static Analyzer Intermediate Representation Front End Back End Compiler / Interpreter

More information

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2]

CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] CS 403 Compiler Construction Lecture 3 Lexical Analysis [Based on Chapter 1, 2, 3 of Aho2] 1 What is Lexical Analysis? First step of a compiler. Reads/scans/identify the characters in the program and groups

More information

CSE 431S Scanning. Washington University Spring 2013

CSE 431S Scanning. Washington University Spring 2013 CSE 431S Scanning Washington University Spring 2013 Regular Languages Three ways to describe regular languages FSA Right-linear grammars Regular expressions Regular Expressions A regular expression is

More information

Regular Expressions & Automata

Regular Expressions & Automata Regular Expressions & Automata CMSC 132 Department of Computer Science University of Maryland, College Park Regular expressions Notation Patterns Java support Automata Languages Finite State Machines Turing

More information

Regular Languages and Regular Expressions

Regular Languages and Regular Expressions Regular Languages and Regular Expressions According to our definition, a language is regular if there exists a finite state automaton that accepts it. Therefore every regular language can be described

More information

Regular Expressions. Chapter 6

Regular Expressions. Chapter 6 Regular Expressions Chapter 6 Regular Languages Generates Regular Language Regular Expression Recognizes or Accepts Finite State Machine Stephen Cole Kleene 1909 1994, mathematical logician One of many

More information

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

More information

Regular Expressions. Steve Renals (based on original notes by Ewan Klein) ICL 12 October Outline Overview of REs REs in Python

Regular Expressions. Steve Renals (based on original notes by Ewan Klein) ICL 12 October Outline Overview of REs REs in Python Regular Expressions Steve Renals s.renals@ed.ac.uk (based on original notes by Ewan Klein) ICL 12 October 2005 Introduction Formal Background to REs Extensions of Basic REs Overview Goals: a basic idea

More information

UNION-FREE DECOMPOSITION OF REGULAR LANGUAGES

UNION-FREE DECOMPOSITION OF REGULAR LANGUAGES UNION-FREE DECOMPOSITION OF REGULAR LANGUAGES Thesis submitted in partial fulfillment of the requirements for the award of degree of Master of Engineering in Computer Science and Engineering Submitted

More information

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np Chapter 1: Introduction Introduction Purpose of the Theory of Computation: Develop formal mathematical models of computation that reflect real-world computers. Nowadays, the Theory of Computation can be

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

More information

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1 Chapter Seven: Regular Expressions Formal Language, chapter 7, slide The first time a young student sees the mathematical constant π, it looks like just one more school artifact: one more arbitrary symbol

More information

Formal Languages and Automata

Formal Languages and Automata Mobile Computing and Software Engineering p. 1/3 Formal Languages and Automata Chapter 3 Regular languages and Regular Grammars Chuan-Ming Liu cmliu@csie.ntut.edu.tw Department of Computer Science and

More information

CS 3100 Models of Computation Fall 2011 This assignment is worth 8% of the total points for assignments 100 points total.

CS 3100 Models of Computation Fall 2011 This assignment is worth 8% of the total points for assignments 100 points total. CS 3100 Models of Computation Fall 2011 This assignment is worth 8% of the total points for assignments 100 points total September 7, 2011 Assignment 3, Posted on: 9/6 Due: 9/15 Thursday 11:59pm 1. (20

More information

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars CMSC 330: Organization of Programming Languages Context Free Grammars Where We Are Programming languages Ruby OCaml Implementing programming languages Scanner Uses regular expressions Finite automata Parser

More information

CS402 - Theory of Automata Glossary By

CS402 - Theory of Automata Glossary By CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Regular Expressions & Automata Department of Computer Science University of Maryland, College Park 1 Regular expressions Notation Patterns Java support Automata

More information

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 2: Lexical Analysis 23 Jan 08

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 2: Lexical Analysis 23 Jan 08 CS412/413 Introduction to Compilers Tim Teitelbaum Lecture 2: Lexical Analysis 23 Jan 08 Outline Review compiler structure What is lexical analysis? Writing a lexer Specifying tokens: regular expressions

More information

CMSC 330: Organization of Programming Languages. Context Free Grammars

CMSC 330: Organization of Programming Languages. Context Free Grammars CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

More information

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Lexical Analysis Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata Phase Ordering of Front-Ends Lexical analysis (lexer) Break input string

More information

Tilings of the Sphere by Edge Congruent Pentagons

Tilings of the Sphere by Edge Congruent Pentagons Tilings of the Sphere by Edge Congruent Pentagons Ka Yue Cheuk, Ho Man Cheung, Min Yan Hong Kong University of Science and Technology April 22, 2013 Abstract We study edge-to-edge tilings of the sphere

More information

UNIT I PART A PART B

UNIT I PART A PART B OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:

More information

Chapter 18: Decidability

Chapter 18: Decidability Chapter 18: Decidability Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter before

More information

ENGI 4421 Counting Techniques for Probability Page Example 3.01 [Navidi Section 2.2; Devore Section 2.3]

ENGI 4421 Counting Techniques for Probability Page Example 3.01 [Navidi Section 2.2; Devore Section 2.3] ENGI 4421 Coutig Techiques fo Pobability Page 3-01 Example 3.01 [Navidi Sectio 2.2; Devoe Sectio 2.3] Fou cads, labelled A, B, C ad D, ae i a u. I how may ways ca thee cads be daw (a) with eplacemet? (b)

More information

Weighted Finite Automatas using Spectral Methods for Computer Vision

Weighted Finite Automatas using Spectral Methods for Computer Vision Weighted Finite Automatas using Spectral Methods for Computer Vision A Thesis Presented by Zulqarnain Qayyum Khan to The Department of Electrical and Computer Engineering in partial fulfillment of the

More information

CMSC 330: Organization of Programming Languages. Context Free Grammars

CMSC 330: Organization of Programming Languages. Context Free Grammars CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

More information

Formal Languages. Grammar. Ryan Stansifer. Department of Computer Sciences Florida Institute of Technology Melbourne, Florida USA 32901

Formal Languages. Grammar. Ryan Stansifer. Department of Computer Sciences Florida Institute of Technology Melbourne, Florida USA 32901 Formal Languages Grammar Ryan Stansifer Department of Computer Sciences Florida Institute of Technology Melbourne, Florida USA 32901 http://www.cs.fit.edu/~ryan/ March 15, 2018 A formal language is a set

More information

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012 CMPSCI 250: Introduction to Computation Lecture #7: Quantifiers and Languages 6 February 2012 Quantifiers and Languages Quantifier Definitions Translating Quantifiers Types and the Universe of Discourse

More information

Section 1.7 Sequences, Summations Cardinality of Infinite Sets

Section 1.7 Sequences, Summations Cardinality of Infinite Sets Section 1.7 Sequences, Summations Cardinality of Infinite Sets Definition: A sequence is a function from a subset of the natural numbers (usually of the form {0, 1, 2,... } to a set S. Note: the sets and

More information

Learn Smart and Grow with world

Learn Smart and Grow with world Learn Smart and Grow with world All Department Smart Study Materials Available Smartkalvi.com TABLE OF CONTENTS S.No DATE TOPIC PAGE NO. UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation

More information

Introduction to Computer Architecture

Introduction to Computer Architecture Boolean Operators The Boolean operators AND and OR are binary infix operators (that is, they take two arguments, and the operator appears between them.) A AND B D OR E We will form Boolean Functions of

More information

8 ε. Figure 1: An NFA-ǫ

8 ε. Figure 1: An NFA-ǫ 0 1 2 3 4 a 6 5 7 8 9 10 LECTURE 27 Figure 1: An FA-ǫ 12.1 ǫ Transitions In all automata that we have seen so far, every time that it has to change from one state to another, it must use one input symol.

More information

On the Parikh-de-Bruijn grid

On the Parikh-de-Bruijn grid On the Parikh-de-Bruijn grid Péter Burcsi Zsuzsanna Lipták W. F. Smyth ELTE Budapest (Hungary), U of Verona (Italy), McMaster U (Canada) & Murdoch U (Australia) Words & Complexity 2018 Lyon, 19-23 Feb.

More information

Theory of Computations III. WMU CS-6800 Spring -2014

Theory of Computations III. WMU CS-6800 Spring -2014 Theory of Computations III WMU CS-6800 Spring -2014 Markov Algorithm (MA) By Ahmed Al-Gburi & Barzan Shekh 2014 Outline Introduction How to execute a MA Schema Examples Formal Definition Formal Algorithm

More information

Section 2.4 Sequences and Summations

Section 2.4 Sequences and Summations Section 2.4 Sequences and Summations Definition: A sequence is a function from a subset of the natural numbers (usually of the form {0, 1, 2,... } to a set S. Note: the sets and {0, 1, 2, 3,..., k} {1,

More information

1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string?

1. Which of the following regular expressions over {0, 1} denotes the set of all strings not containing 100 as a sub-string? Multiple choice type questions. Which of the following regular expressions over {, } denotes the set of all strings not containing as a sub-string? 2. DFA has a) *(*)* b) ** c) ** d) *(+)* a) single final

More information

QUESTION BANK. Unit 1. Introduction to Finite Automata

QUESTION BANK. Unit 1. Introduction to Finite Automata QUESTION BANK Unit 1 Introduction to Finite Automata 1. Obtain DFAs to accept strings of a s and b s having exactly one a.(5m )(Jun-Jul 10) 2. Obtain a DFA to accept strings of a s and b s having even

More information

Regular Languages. Regular Language. Regular Expression. Finite State Machine. Accepts

Regular Languages. Regular Language. Regular Expression. Finite State Machine. Accepts Regular Languages L Regular Language Regular Expression Accepts Finite State Machine Regular Expressions The regular expressions over an alphabet are all and only the strings that can be obtained as follows:

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Context Free Grammars and Parsing 1 Recall: Architecture of Compilers, Interpreters Source Parser Static Analyzer Intermediate Representation Front End Back

More information

CMSC 330: Organization of Programming Languages. Context-Free Grammars Ambiguity

CMSC 330: Organization of Programming Languages. Context-Free Grammars Ambiguity CMSC 330: Organization of Programming Languages Context-Free Grammars Ambiguity Review Why should we study CFGs? What are the four parts of a CFG? How do we tell if a string is accepted by a CFG? What

More information

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA

TOPIC PAGE NO. UNIT-I FINITE AUTOMATA TABLE OF CONTENTS SNo DATE TOPIC PAGE NO UNIT-I FINITE AUTOMATA 1 Introduction 1 2 Basic Mathematical Notation Techniques 3 3 Finite State systems 4 4 Basic Definitions 6 5 Finite Automaton 7 6 DFA NDFA

More information

Alphabets, strings and formal. An introduction to information representation

Alphabets, strings and formal. An introduction to information representation Alphabets, strings and formal languages An introduction to information representation 1 Symbols Definition: A symbol is an object endowed with a denotation (i.e. literal meaning) Examples: Variables are

More information

Languages and Finite Automata

Languages and Finite Automata Languages and Finite Automata or how to talk to machines... Costas Busch - RPI 1 Languages A language is a set of strings String: A sequence of letters (a word) Examples: cat, dog, house, Defined over

More information

Key to Homework #8. (a) S aa A bs bbb (b) S AB aaab A aab aaaaaaab B bba bbbb

Key to Homework #8. (a) S aa A bs bbb (b) S AB aaab A aab aaaaaaab B bba bbbb Key to Homework #8 1. For each of the following context-free grammars (a) and (b) below, construct an LL(k) parser with minimum k according to the following guide lines (i) and (ii). (a) a b bbb (b) B

More information

Name: Finite Automata

Name: Finite Automata Unit No: I Name: Finite Automata What is TOC? In theoretical computer science, the theory of computation is the branch that deals with whether and how efficiently problems can be solved on a model of computation,

More information

LECTURE NOTES THEORY OF COMPUTATION

LECTURE NOTES THEORY OF COMPUTATION LECTURE NOTES ON THEORY OF COMPUTATION P Anjaiah Assistant Professor Ms. B Ramyasree Assistant Professor Ms. E Umashankari Assistant Professor Ms. A Jayanthi Assistant Professor INSTITUTE OF AERONAUTICAL

More information

Turing Machine Languages

Turing Machine Languages Turing Machine Languages Based on Chapters 23-24-25 of (Cohen 1997) Introduction A language L over alphabet is called recursively enumerable (r.e.) if there is a Turing Machine T that accepts every word

More information

CSCE 314 Programming Languages

CSCE 314 Programming Languages CSCE 314 Programming Languages Syntactic Analysis Dr. Hyunyoung Lee 1 What Is a Programming Language? Language = syntax + semantics The syntax of a language is concerned with the form of a program: how

More information

MA/CSSE 474. Today's Agenda

MA/CSSE 474. Today's Agenda MA/CSSE 474 Theory of Computation Course Intro Today's Agenda Student questions Overview of yesterday's proof I placed online a "straight-line" writeup of the proof in detail, without the "here is how

More information

LECTURE NOTES THEORY OF COMPUTATION

LECTURE NOTES THEORY OF COMPUTATION LECTURE NOTES ON THEORY OF COMPUTATION Dr. K Rajendra Prasad Professor Ms. N Mamtha Assistant Professor Ms. S Swarajya Lakshmi Assistant Professor Mr. D Abdulla Assistant Professor INSTITUTE OF AERONAUTICAL

More information

A Formal Study of Practical Regular Expressions

A Formal Study of Practical Regular Expressions International Journal of Foundations of Computer Science c World Scientific Publishing Company A Formal Study of Practical Regular Expressions Cezar Câmpeanu Department of Mathematics and Computer Science,

More information

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table. Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory

More information

C C+D+A+) (B+A+C+C+C C C C+C A+) 53549

C C+D+A+) (B+A+C+C+C C C C+C A+) 53549 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 Educational District Name NEYYATTINKARA The grades awarded for the candidate along with the register

More information

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University

More information

Talen en Compilers. Johan Jeuring , period 2. January 17, Department of Information and Computing Sciences Utrecht University

Talen en Compilers. Johan Jeuring , period 2. January 17, Department of Information and Computing Sciences Utrecht University Talen en Compilers 2015-2016, period 2 Johan Jeuring Department of Information and Computing Sciences Utrecht University January 17, 2016 13. LR parsing 13-1 This lecture LR parsing Basic idea The LR(0)

More information

AUBER (Models of Computation, Languages and Automata) EXERCISES

AUBER (Models of Computation, Languages and Automata) EXERCISES AUBER (Models of Computation, Languages and Automata) EXERCISES Xavier Vera, 2002 Languages and alphabets 1.1 Let be an alphabet, and λ the empty string over. (i) Is λ in? (ii) Is it true that λλλ=λ? Is

More information

CS201 Discussion 7 MARKOV AND RECURSION

CS201 Discussion 7 MARKOV AND RECURSION CS201 Discussion 7 MARKOV AND RECURSION Before we begin Any questions about the midterm solutions? Making a Markov Map Recall that in Markov, we re trying to make a map of all k-grams to all k-grams that

More information

Computer Science. Unit-4: Introduction to Boolean Algebra

Computer Science. Unit-4: Introduction to Boolean Algebra Unit-4: Introduction to Boolean Algebra Learning Objective At the end of the chapter students will: Learn Fundamental concepts and basic laws of Boolean algebra. Learn about Boolean expression and will

More information

Structure of Programming Languages Lecture 3

Structure of Programming Languages Lecture 3 Structure of Programming Languages Lecture 3 CSCI 6636 4536 Spring 2017 CSCI 6636 4536 Lecture 3... 1/25 Spring 2017 1 / 25 Outline 1 Finite Languages Deterministic Finite State Machines Lexical Analysis

More information

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou Administrative! [ALSU03] Chapter 3 - Lexical Analysis Sections 3.1-3.4, 3.6-3.7! Reading for next time [ALSU03] Chapter 3 Copyright (c) 2010 Ioanna

More information

HKN CS 374 Midterm 1 Review. Tim Klem Noah Mathes Mahir Morshed

HKN CS 374 Midterm 1 Review. Tim Klem Noah Mathes Mahir Morshed HKN CS 374 Midterm 1 Review Tim Klem Noah Mathes Mahir Morshed Midterm topics It s all about recognizing sets of strings! 1. String Induction 2. Regular languages a. DFA b. NFA c. Regular expressions 3.

More information

Data Compression Fundamentals

Data Compression Fundamentals 1 Data Compression Fundamentals Touradj Ebrahimi Touradj.Ebrahimi@epfl.ch 2 Several classifications of compression methods are possible Based on data type :» Generic data compression» Audio compression»

More information

System & Network Engineering. Regular Expressions ESA 2008/2009. Mark v/d Zwaag, Eelco Schatborn 22 september 2008

System & Network Engineering. Regular Expressions ESA 2008/2009. Mark v/d Zwaag, Eelco Schatborn 22 september 2008 1 Regular Expressions ESA 2008/2009 Mark v/d Zwaag, Eelco Schatborn eelco@os3.nl 22 september 2008 Today: Regular1 Expressions and Grammars Formal Languages Context-free grammars; BNF, ABNF Unix Regular

More information

Dr. D.M. Akbar Hussain

Dr. D.M. Akbar Hussain 1 2 Compiler Construction F6S Lecture - 2 1 3 4 Compiler Construction F6S Lecture - 2 2 5 #include.. #include main() { char in; in = getch ( ); if ( isalpha (in) ) in = getch ( ); else error (); while

More information

Models of Computation II: Grammars and Pushdown Automata

Models of Computation II: Grammars and Pushdown Automata Models of Computation II: Grammars and Pushdown Automata COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Catch Up / Drop in Lab Session 1 Monday 1100-1200 at Room 2.41

More information

Suffix Trees and Arrays

Suffix Trees and Arrays Suffix Trees and Arrays Yufei Tao KAIST May 1, 2013 We will discuss the following substring matching problem: Problem (Substring Matching) Let σ be a single string of n characters. Given a query string

More information

The Kuratowski Closure-Complement Theorem

The Kuratowski Closure-Complement Theorem By Greg Strabel The Kuratowski Closure-Complement Theorem, a result of basic point-set topology, was first posed and proven by the Polish mathematician Kazimierz Kuratowski in 1922. Since then, Kuratowski

More information

Slides for Faculty Oxford University Press All rights reserved.

Slides for Faculty Oxford University Press All rights reserved. Oxford University Press 2013 Slides for Faculty Assistance Preliminaries Author: Vivek Kulkarni vivek_kulkarni@yahoo.com Outline Following topics are covered in the slides: Basic concepts, namely, symbols,

More information