





































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






































● (^) We've seen two models for the regular languages: ● (^) Finite automata accept precisely the strings in the language. ● (^) Regular expressions describe precisely the strings in the language. ● Finite automata recognize strings in the language. ● (^) Perform a computation to determine whether a specific string is in the language. ● (^) Regular expressions match strings in the language. ● (^) Describe the general shape of all strings in the language.
● (^) Suppose we want to describe all legal arithmetic expressions using addition, subtraction, multiplication, and division. ● (^) Here is one possible CFG: E → int E → E Op E E → (E) Op → + Op → - Op → *** Op** → /
⇒ E Op E ⇒ E Op (E) ⇒ E Op (E Op E) ⇒ E * (E Op E) ⇒ int * (E Op E) ⇒ int * (int Op E) ⇒ int * (int Op int) ⇒ int * (int + int)
● (^) Suppose we want to describe all legal arithmetic expressions using addition, subtraction, multiplication, and division. ● (^) Here is one possible CFG: E → int E → E Op E E → (E) Op → + Op → - Op → *** Op** → /
⇒ E Op E ⇒ E Op int ⇒ int Op int ⇒ int / int
●
● i.e. A , B , C , D ●
● (^) i.e. t , u , v , w ●
● i.e. α , γ , ω
E → int E → E Op E E → (E) Op → + Op → - Op → *** Op** → /
⇒ E ⇒ E Op E ⇒ E Op (E) ⇒ E Op (E Op E) ⇒ E * (E Op E) ⇒ int * (E Op E) ⇒ int * (int Op E) ⇒ int * (int Op int) ⇒ int * (int + int) ● A sequence of steps where nonterminals are replaced by the right-hand side of a production is called a derivation. ● If string α derives string ω , we write α ⇒
ω. ● In the example on the left, we see E ⇒
int * (int + int). E → E Op E | int | ( E ) Op → + | ***** | - | /
●
●
●
●
●
S → ab*
●
●
S → Ab A → Aa | ε
●
●
S → aX X → b | C C → Cc | ε
●
●
●
Regular Languages CFLs All Languages
●
●
a a a a b b b b