Close
Register
Close Window

CSC303: Theory of Computation

Chapter 6 Context-Free Grammars and Languages

Show Source |    | About   «  5.1. Identifying Non-regular Languages   ::   Contents   ::   6.2. Context-Free Grammars Part 2  »

6.1. Context-Free Grammars Part 1

6.1.1. Context-Free Languages

In previous chapters, we saw that some languages are regular languages, which means that we can define a DFA, NFA that recognizes that language, or we can represent it with a regular expression or regular grammar. Here are a few examples of regular languages:

  • keywords in a programming language

  • names of identifiers

  • integers

  • a finite list of miscillaneous symbols such as \(=\).

We also know that some languages are non-regular, and we learned how to use tools like the Pumping Lemma to prove a given language is non-regular. Examples of non-regular languages include:

  • \(\{a^ncb^n\ |\ n > 0\}\)

  • mathematical expressions like \(((a + b) - c)\)

  • block structures for programming languages (\(\{\}\) in Java/C++ and beginend in Pascal)

  • Balanced parentheses

Now we will look at a class of languages that is larger than the class of regular languages, called context-free languages or CFG. Perhaps not surprisingly, a CFL is any language that can be represented by a context-free grammar or CFG.

Settings

Proficient Saving... Error Saving
Server Error
Resubmit

6.1.2. String Derivation

Settings

Proficient Saving... Error Saving
Server Error
Resubmit

6.1.3. Derivation Trees

Settings

Proficient Saving... Error Saving
Server Error
Resubmit

6.1.4. Derivation Trees Example

Settings

Proficient Saving... Error Saving
Server Error
Resubmit

6.1.5. Practice question 1

6.1.6. Membership Problem

Settings

Proficient Saving... Error Saving
Server Error
Resubmit

6.1.7. Practice question 2

   «  5.1. Identifying Non-regular Languages   ::   Contents   ::   6.2. Context-Free Grammars Part 2  »

nsf
Close Window