1 / 49

Erik Jonsson School of Engineering and Computer Science

Erik Jonsson School of Engineering and Computer Science. CS 4384 – 0 01. Automata Theory. http://www.utdallas.edu/~pervin. Tuesday: Context-Free Languages Sections 3.4-3.5. Thursday 2-27-14. FEARLESS Engineering. Distinguished States. Distinguished States. Context-free Languages.

dusty
Download Presentation

Erik Jonsson School of Engineering and Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Erik Jonsson School of Engineering and Computer Science CS 4384– 001 Automata Theory http://www.utdallas.edu/~pervin Tuesday: Context-Free Languages Sections 3.4-3.5 Thursday2-27-14 FEARLESS Engineering

  2. Distinguished States

  3. Distinguished States

  4. Context-free Languages Chapter Three Tuesday 2-25

  5. A context-free grammar is “context-free’’ because we can use a rule R no matter what the context. E.g., (M&S P.89, Def. 3.1.2) from the rule R: A -> w, we can derive from the string uAv in one step the string uwv, no matter what the context (that is, for any strings u and v). Context-free

  6. Palindromes

  7. Any positive even number of a’s with any number of b’s anywhere

  8. G = (V, ∑, R, E) V = {E, T, F} ∑= {x, 1, 2, +, *, (, )} R = { E -> E + T | T; T -> T * F | F; F -> (E) | x1 | x2 } Expressions, Terms, Factors Parsing Expressions

  9. Parse Tree

  10. Closure Properties

  11. For every regular language L, there exists a CFG G such that L=L(G). Proof. Let L=L(M) for a DFA M=(Q, Σ, δ, s, F). Construct a CFG G=(V, Σ, R, S) as follows. V = Q, Σ = Σ, R = { q → ap | δ(q, a) = p } U { f → ε | f in F}, S = q0. Theorem x1 xn S x1q1 x1x2q2 ··· x1…xnf x1…xn f=qn s q1

  12. Regular Grammars Note: A -> a is unnecessary

  13. What's wrong with (ab)*a*?

  14. Homework 9 Answer 1

  15. Homework 10 Answer 2

  16. Simplified and Normal Forms

  17. Chomsky Normal Form

  18. Extended Example

  19. Converting to Chomsky Normal Form

  20. Note that we don't need both Y1 and Y3, or both Y2 and Y4 so we could simplify slightly.

  21. The empty string

  22. Other Simplifications Useful variables and productions Left-recursion

  23. Useless Example

  24. Left-recursion

  25. Pushdown Automata Many similar definitions

More Related