Presentation is loading. Please wait.

Presentation is loading. Please wait.

Context Free Grammars and Regular Grammars Needs for CFG Grammars and Production Rules Context Free Grammars (CFG) Regular Grammars (RG)

Similar presentations


Presentation on theme: "Context Free Grammars and Regular Grammars Needs for CFG Grammars and Production Rules Context Free Grammars (CFG) Regular Grammars (RG)"— 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.


Download ppt "Context Free Grammars and Regular Grammars Needs for CFG Grammars and Production Rules Context Free Grammars (CFG) Regular Grammars (RG)"

Similar presentations


Ads by Google