1 / 40

Theory of Computation Regular Expressions & Context-Free Languages

Theory of Computation Regular Expressions & Context-Free Languages. Prof. Muhammad Saeed. Regular Expressions. Regular Expression. Regular Expressions. Regular Expressions. Precedence of Regular Expression Operators. Regular Expressions. Regular Expressions.

evan-ayers
Download Presentation

Theory of Computation Regular Expressions & Context-Free Languages

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. Theory of Computation Regular Expressions & Context-Free Languages Prof. Muhammad Saeed

  2. Regular Expressions Regular Expression Dept. of Computer Science & IT, FUUAST Theory of Computation

  3. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  4. Regular Expressions Precedence of Regular Expression Operators Dept. of Computer Science & IT, FUUAST Theory of Computation

  5. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  6. Regular Expressions Represent the following sets by regular expression • {a,bc} • {1,11,111,1111,………..} • {ab, a, b, bb} • {b2 , b5 , b8 , ………….} • {a2n+1 | n≥0} Write Regular expression for the following languages d) L1 ={a2n b2m+1 | n≥0, m ≥0 } Dept. of Computer Science & IT, FUUAST Theory of Computation

  7. Regular Expressions Identities: Dept. of Computer Science & IT, FUUAST Theory of Computation

  8. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  9. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  10. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  11. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  12. Regular Expressions Converting Regular Expressions to Automata R + S L(R)⋃L(S) RS L(R)L(S) Dept. of Computer Science & IT, FUUAST Theory of Computation

  13. Regular Expressions R* L(R*) Regular Expression to an є-NFA Dept. of Computer Science & IT, FUUAST Theory of Computation

  14. Regular Expressions a) Regular Expression to an є-NFA b) Dept. of Computer Science & IT, FUUAST Theory of Computation

  15. Regular Expressions c) Dept. of Computer Science & IT, FUUAST Theory of Computation

  16. Regular Expressions Closure properties of Regular Languages: Dept. of Computer Science & IT, FUUAST Theory of Computation

  17. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  18. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  19. Regular Expressions Dept. of Computer Science & IT, FUUAST Theory of Computation

  20. Context-Free Languages ( CFL ) Dept. of Computer Science & IT, FUUAST Theory of Computation

  21. Context-Free Languages ( CFG ) Dept. of Computer Science & IT, FUUAST Theory of Computation

  22. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  23. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  24. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  25. Context-Free Languages Rules: Productions: Derivation Symbols Dept. of Computer Science & IT, FUUAST Theory of Computation

  26. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  27. Context-Free Languages Derivation Symbols Dept. of Computer Science & IT, FUUAST Theory of Computation

  28. Context-Free Languages Language Of a Grammar Dept. of Computer Science & IT, FUUAST Theory of Computation

  29. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  30. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  31. Context-Free Languages Parse Trees Dept. of Computer Science & IT, FUUAST Theory of Computation

  32. Context-Free Languages Ambiguous Grammars Dept. of Computer Science & IT, FUUAST Theory of Computation

  33. Context-Free Languages Ambiguous Grammars Dept. of Computer Science & IT, FUUAST Theory of Computation

  34. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  35. Context-Free Languages Useless Productions G = (V,T,S,P) is Context-free Grammar with P, S → aSb | λ | A A → aA A is useful if there is at least one w ϵ L(G) such that S xAy w • Empty Productions • A → λ, A λ b) Unit Productions A → B, A B c) Left Recursion A → Ax Dept. of Computer Science & IT, FUUAST Theory of Computation

  36. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  37. Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation

  38. Context-Free Languages Normal Forms 1) Chomsky Normal Forms 2) Greibach Normal Forms Chomsky Normal Forms (CNF) Any context-free language without any λ- production and unit production is generated by a grammar in which productions are of the form Dept. of Computer Science & IT, FUUAST Theory of Computation

  39. Context-Free Languages 2) 3) Dept. of Computer Science & IT, FUUAST Theory of Computation

  40. END Dept. of Computer Science & IT, FUUAST Theory of Computation

More Related