Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4020928
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:17:20+00:00 2026-05-20T10:17:20+00:00

I’ve been working on this for about 5 hours for homework and I was

  • 0

I’ve been working on this for about 5 hours for homework and I was hoping some of you guys might be able to help since CFG’s are a huge part of CS.

My real trouble is with part C.

Design a CFG for each of the following languages:

A. {(a^i)(b^j)(c^k)} WHERE (i != j) AND i,j,k >= 0)

I came up with:

Start-> aAB | AbB
A-> epsilon | aA
B-> epsilon | C | bB
C-> epsilon | cC

This seems to work for bccc, abbcc, aabbb,cc so I think I am good here.

B. {(a^i)(b^j)(c^k)} WHERE (i != k) AND i,j,k >= 0)

Start-> aABC | ABcC
A-> epsilon | aA
B-> epsilon | bB
C-> epsilon | cC

This works for bc, bbcc, ab, abb, aac so all looks well for when i!=k

C. {(a^i)(b^j)(c^k)} WHERE (i != j OR i != k) AND i,j,k >= 0)

Start-> aABC | AbB | ABcC
A-> epsilon | aA
B-> epsilon | bB | C
C-> epsilon | cC

I do not think part C is correct but I believe A and B are correct. Can anyone tell me if I am right/wrong or help in anyway? I believe since in the last case I am just doing a OR, and because my A,B,C variables are pretty much the same I can get away with combining. It seems to work as bc works, acc works and many others but I get the feeling I should not simply be combining start states.

Anyone know if I am right or close or have any tips?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:17:20+00:00Added an answer on May 20, 2026 at 10:17 am

    Remember that when you are testing grammars, be sure to also test with strings that should be rejected (see @Paulo’s answer for some that fail for you currently). To solve the first two, write a grammar that represents A^i B^j where i != j; add a grammar for an arbitrary number of c‘s onto the end of that for part 1, and add that grammar into the middle for part 2. For part 3, remember that the union of two grammars can be easily written as a grammar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.