O'Reilly logo

Formal Languages and Automata Theory by K.V.N. Sunitha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4

Context Free Grammars and Context Free Languages

  • Syntax of high-level languages is defined with Context Free Grammars. Hence, these are used as a powerful tool by the parsers in verifying the syntax of any highlevel language.

In this chapter, we will discuss (1) context free grammar, (2) Language, (3) derivation tree, (4) leftmost derivation and (5) rightmost derivation. We also discuss ambiguous grammars, simplification of grammars and normal forms.

4.1  Context Free Grammars

For a regular grammar, the productions are restricted in two ways: the left side must be a single variable, while the right side can be any string of terminals and non-terminals. To create grammars that are very powerful, we must ease off some of the restrictions. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required