1 / 5

Context Free Grammars and Regular Grammars

Context Free Grammars and Regular Grammars. Needs for CFG Grammars and Production Rules Context Free Grammars (CFG) Regular Grammars (RG). Needs for CFG. Regular expressions were inadequate to define all interesting languages and therefore we need more powerful language defining structure.

Download Presentation

Context Free Grammars and Regular Grammars

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. Context Free Grammars and Regular Grammars Needs for CFG Grammars and Production Rules Context Free Grammars (CFG) Regular Grammars (RG)

  2. Needs for CFG • Regular expressions were inadequate to define all interesting languages and therefore we need more powerful language defining structure. • Why do we still need regular language if context free language is more powerful?

  3. Grammars and Production Rules • G = ( V, T, S, P) is a set of rules that governs the manner in which the tokens of T may be organized into strings in a language. • T -- set of terminal symbols • V -- set of nonterminal symbols • S -- a element of V, starting symbol • P -- set of production rules of certain format restrictions which determine the class of grammar

  4. Context Free Grammars(the representation defining CFL) • A grammar is said to be context-free if all productions in P have the form A --> x, where A is a single nonterminal and x can be any string of terminals or/and nonterminals. • Single nonterminal makes the grammar context-free.

  5. Regular Grammars(one of 4 representations of RL) • A context-free grammar is said to be regular grammar if all productions in P have the form A --> x, where A is a single nonterminal and x can be a word or semiword. • Word -- a string of terminals • Semiword -- a string of terminals ended with a nonterminal.

More Related