Close
Register
Close Window

CS4114 Formal Languages and Automata: Spring 2022

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, regular expression, or regular grammar for them. We also discussed using closure operators to show that other languages are regular if they can be derived from known regular languages using operators known to be closed for regular languages. Examples of regular languages:

  • keywords in a programming language

  • names of identifiers

  • integers

  • a finite list of miscillaneous symbols such as = \ ;

Then we discussed ways to prove that a language is non-regular, such as using the Pumping Lemma or using operators known to be closed for regular language to derive a known non-regular language. Exxamples of non-regular languages include:

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

  • expressions: \(((a + b) - c)\)

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

  • Balanced parentheses

We know that not all languages are not regular, since we’ve proved that some are not.

(Something to think about: If you were to write a program in your favorite programming language to recognize any of those languages, what is the minimum memory that you need for each?)

Now we will look at a class of languages that is larger than the class of regular languages, context-free languages. And we will discuss ways to represent them.

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