FSA - Regular Expressions, Finite State Automata, Finite...

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

View Full Document Right Arrow Icon
Regular Expressions, Finite State Automata, Finite State Machines By Kendra Cooper Contents Introduction Alphabets and languages Regular Expressions, Languages, and Grammars Chompsky’s Hierarchy Finite State Automata Finite State Machines Extensions to Finite State Machines Problems Introduction In CPSC, we have to be able to precisely and unambiguously describe the syntax for a programming language. Compilers determine if a string of symbols constitutes a grammatically correct program Programming languages can be defined with automata In this course, we cover the simplest kind of automata, finite state automata and finite state machines (in the automata course, other more complex automata are covered) A finite state machine is an abstract model of a machine with a primitive memory. Finite state machines vs. finite state automata o A finite state machine has output. o A finite state automaton does not have output. Alphabets and languages There is a set of symbols called an alphabet A A string (or word ) of symbols has the form a 1 a 2 a 3 …a n , where a i A Examples A= {0,1} // in this example, the alphabet is
Background image of page 1

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

View Full DocumentRight Arrow Icon
// composed of 0 and 1 W1 = 0 // word 1 W2 = 1 // word 2 W3 = 01 // word 3 Notation λ is the null string (there are no symbols in this string) A* is the set of all strings of length greater than or equal to 0 Example: A = {a,b} // the alphabet is composed of a and b A* = { λ , a,b,aa,ab,ba,bb,aaa,aab,…} A language is a subset of A* // The symbol * is called the Kleene star. Regular Expressions, Languages, and Grammars A class of languages called “regular languages” is of interest to us. There are 3 ways to describe a regular language: 1. regular expression 2. the set containing the elements in the language 3. regular grammar Regular Expressions We can construct regular expressions from primitive constituents by repeatedly applying recursive rules : Let A be a given alphabet. 1. (empty set), λ (empty string) and a A are all regular expressions. These are primitive regular expressions 2. if w1 and w2 are regular expressions, then w1 w2, w1 w2, w1*, and (w1) are regular expressions 3. a string is a regular expression if and only if it can be derived from the primitive regular expressions by a finite number of applications of the rules in (2). A regular expression in A uses the symbols *, , λ , (, ), where:
Background image of page 2
* star-closure (aka iteration) 10* a 1 followed by zero or more 0’s union (selection) 0 01 the string 0 or the string 01 concatenation 1 0 the string 10 λ empty string λ• 01 the string 01 ( delimiter
Background image of page 3

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

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

Page1 / 17

FSA - Regular Expressions, Finite State Automata, Finite...

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

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