Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Make a graph to model actions and states of the world
Based on where I am, and what I see, go elsewhere
Each Node is a State, and they are finite
Each Node is a State, and they are finite
Basis for Push Down Automata and Turing Machines
Limited operations, but enough for Regex
Recall the things we needed for Regex
Recall the things we needed for Regex
Recall that a Regex describes a set of strings
This set is called the language
Recall the things we needed for Regex
\(L_1 = \{'c'\}, L_2 = \{'m'\}, L_{3} = \{'s'\}\)
\(L_1L_2L_3L_1\) = /cmsc/
Recall the things we needed for Regex
\(L_1 = \{'a'\}, L_2 = \{'b'\}, \dots, L_{26} = \{'z'\}\)
\(L_1\cup L_2\cup \dots \cup L_{26}\) = /[a-z]/
\(L_1 = \{'a'\}, L_2 = \{'b'\}, \dots, L_{26} = \{'z'\}\)
\(L_1\cup L_2\cup \dots \cup L_{26}\) = /[a-z]/
\(L_{27} = \{'0'\}, L_{28} = \{'1'\}, \dots, L_{37} = \{'9'\}\)
\((L_1\cup \dots \cup L_{26})(L_{27}\cup \dots \cup L_{37})\) = /[a-z][0-9]/
\(((L_1\cup \dots \cup L_{3})(L_1\cup \dots \cup L_{3}))\cup (L_1\cup \dots \cup L_{3})\) = /[abc]{1,2}/
\(L_{38} = \{'-'\}\)
\((L_{38}(L_{27}\cup \dots \cup L_{37}))\cup (L_{27}\cup \dots \cup L_{37})\) = /-?\d/
\((L_1\cup \dots \cup L_{n})\) = /./
Recall the things we needed for Regex
\(L_1 = \{'a'\}\)
\(L_1^*\) = /a*/
\(L_1L_1^*\) = /a+/
We can put everything together to make a grammer
\(\begin{array}{rl} R \rightarrow & \emptyset\\ & \vert \epsilon\\ & \vert \sigma \\ & \vert R_1R_2\\ & \vert R_1\vert R_2\\ & \vert R_1^*\\ \end{array} \)
More on Grammars later
More on Grammars later
Languages created by Regular expressions are regular languages
Suppose \(L\) is a language created by a RE \(r\)
If string \(s \in L\) then \(r\) accepts \(s\)
Not everything can described with Regex
Goal: create a machine to see if \(r\) accepts \(s\)
This machine can be represented by a FSM
Let's break this down
Let's break this down
Let's break this down
Let's break this down
What is this Regex?
even binary numbers or the empty string
What is this Regex?
/((a*b+)|(a+b*))c+/
What is this Regex?
month/day/year Date format
What would this machine look like?
Strings with even number of 0s and odd number of 1s
What would this machine look like?
strings of a, b, and c with no same consucutive letters