Book contents
- Frontmatter
- Contents
- Preface
- Acknowledgements
- List of Abbreviations
- 1 Fundamentals of Automata
- 2 Formal Language Theory
- 3 Regular Expressions and Languages
- 4 Finite Automata
- 5 Equivalent Automata
- 6 Minimisation/Optimisation of DFA
- 7 Finite Automata and Regular Expressions
- 8 Transducers
- 9 Context-Free Grammars and Context-Free Languages
- 10 Simplification of Context-Free Grammar
- 11 Pushdown Automata
- 12 Pumping Lemma
- 13 Turing Machine
- 14 TM Extensions and Languages
- 15 Formal Languages/Grammar Hierarchy
- Appendix A Symbol Chart
- Appendix B Sets, Relations, Functions and Mathematical Induction
- Appendix C System Modelling
- Index
9 - Context-Free Grammars and Context-Free Languages
Published online by Cambridge University Press: 26 October 2011
- Frontmatter
- Contents
- Preface
- Acknowledgements
- List of Abbreviations
- 1 Fundamentals of Automata
- 2 Formal Language Theory
- 3 Regular Expressions and Languages
- 4 Finite Automata
- 5 Equivalent Automata
- 6 Minimisation/Optimisation of DFA
- 7 Finite Automata and Regular Expressions
- 8 Transducers
- 9 Context-Free Grammars and Context-Free Languages
- 10 Simplification of Context-Free Grammar
- 11 Pushdown Automata
- 12 Pumping Lemma
- 13 Turing Machine
- 14 TM Extensions and Languages
- 15 Formal Languages/Grammar Hierarchy
- Appendix A Symbol Chart
- Appendix B Sets, Relations, Functions and Mathematical Induction
- Appendix C System Modelling
- Index
Summary
‘Grammar is the mathematics of a language and mathematics is the grammar of creation.’
Introduction
In any language such as English, Hindi or Sanskrit, words can be combined in several ways. Naturally, some combinations form valid sentences, while others do not. The validity of a sentence is determined by the grammar of a language, which comprises a set of rules. For instance, ‘The boy prepares tea quickly’, although meaningless, is a perfectly legal sentence. In other words, the sentences in a language may be nonsensical, but they must obey the rules of grammar. The discussion in this chapter deals with only the syntax of sentence (the way the words are combined) and not with the semantics of sentences (meaning).
In the previous chapters, two different (though equivalent) methods: finite automata and regular expressions were introduced for describing languages. These methods have their own limitations in the sense that some simple languages, such as {0n1n|n ≥ 0}, cannot be described by these methods. Formal languages and grammars are widely used in connection with programming languages. During programming, we proceed with an intuitive knowledge of the languages, which leads to errors. Therefore, a precise description of the language is needed, at almost every step, which helps to understand the syntax diagrams found in programming texts. Among the ways in which programming languages can be defined precisely, grammars or context-free grammars are most widely used. This method happens to be a very powerful method and such grammars can describe certain features which have a recursive structure. Context-free-grammars (CFG) were first used in the study of human languages.
- Type
- Chapter
- Information
- A Textbook on Automata Theory , pp. 304 - 376Publisher: Foundation BooksPrint publication year: 2007