Purchase Solution

Explain the language accepted by the given grammar

Not what you're looking for?

Ask Custom Question

Given the following grammar, where upper-case letters are non-terminals and lower-case letters are terminals. Which strings are valid?

Purchase this Solution

Solution Summary

In this solution I explain how a given grammar, expressed in BNF-type notation, generates a series of strings. In particular, I show which strings are accepted and which are rejected by the given grammar.

Solution Preview

The best approach for this problem is to get a good understanding of what the grammar is accepting. Starting from S there are two paths: A and B. Let's look at each path separately.

The first A rule is:

A -> aCbA

C is defined as simply "ba" so we can substitute that in and rewrite the first A rule as:

A -> ababA

Notice that this is recursive so it would never stop unless it hits the terminating case. That is the second A rule. The second A rule is:

A -> ab

So for the A path we can describe the set ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C# variables and classes

This quiz contains questions about C# classes and variables.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Networking Questions

This quiz consists of some basic networking questions.