Ch2-Regular Expressions & Languages

Ch2-Regular Expressions & Languages - Digital State...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Digital State Machines Regular Expressions & Languages 2/11/12 Veton Kpuska 2 Chapter Outline u Regular Expressions n Basic Regular Expression Patterns n Disjunction, Grouping and Precedence n Examples n Advanced Operators n Regular Expression Substitution, Memory and ELIZA u Summary Regular Expressions (RE) u Algebraic Description of finite state automata. u Regular Expressions can define exactly the same languages that the various forms of automata describe: regular languages. u Regular Expressions (RE) offer a declarative way to express the strings we want to accept FSA do not! n REs serve as the input language for many systems that process strings: u Search commands such as UNIX grep (egrep, etc.) for finding strings: n WWW Browsers, n Text-formatting systems, etc. u Search Systems convert REs into FSA(s) (D-FSA or N-FSA). n Lexical-analyzer generators, such as LEX or FLEX. u Compiler, u Language Modeling System in a Speech Recognizer. u Grammar and Spell Checkers. 2/11/12 Veton Kpuska 3 2/11/12 Veton Kpuska 4 FSA, RE and Regular Languages Finite automata Regular languages Regular expressions The Operators of Regular Expressions u Regular Expressions denote languages. n 01*+10* - denotes the language consisting of all strings that are either a: u {0, 01, 011, 0111, 01111,}, or u {1, 10, 100, 1000, 10000, } u Operations on Regular Languages that Regular Expressions Represent. Let L, L1 and L2 be regular languages, L={0,1}, L1 = {10, 001, 111} & L2 = { , 001}, then 1. The union: L1 L2, the union or disjunction of L1 and L2. u L1 L2 = { , 10, 001, 111} 2. The concatenation: L1L2 = {xy|x L1, y L2}. u L1 L2 = {10, 001, 111, 10001, 00001, 111001} 3. The closure (or star, *, or Kleene closure) : L*. u L* = {L0, L1, L2,, Li,, L} 2/11/12 Veton Kpuska 5 Example u L={0,11}, n L0 = { } independent of what language L is. n L1 = L represents the choice of one string from L. u {L0, L1} = { , 0 , 1 1 } n L2 = { 0 0 , 0 1 1 ,1 1 0 ,1 1 1 1 } n L3 = { 0 0 0 , 0 0 1 1 , 0 1 1 0 , 0 1 1 1 1 ,1 1 0 0 ,1 1 0 1 1 ,1 1 1 1 0 ,1 1 1 1 1 1 } n To compute L* must compute L i for each i (" i ) n L i has 2 i members. n Union of infinite number of terms L i is generally an infinite language (L*) as it is this example. 2/11/12 Veton Kpuska 6 Example u Let L={ , 0, 00, 000, } a set of strings consisting all zeros. L is infinite language n L0 = { } independent of what language L is....
View Full Document

Page1 / 74

Ch2-Regular Expressions & Languages - Digital State...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online