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 6569163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:35:32+00:00 2026-05-25T14:35:32+00:00

L = ((a^n)(b^n+m)(a^m)) | n, m = 0, 1, 2…) I’m new to context

  • 0
L = ((a^n)(b^n+m)(a^m)) | n, m = 0, 1, 2...)

I’m new to context free grammar and know the basics, but I’ve been struggling with this for a while.

For starters, I dont know what this part of the code means:

| n, m = 0, 1, 2...)

And secondly, how is it possible to have the same variable with different exponents? I feel like I’m not getting the full concept.

Edit: I also need to be able to construct the rules to construct this grammar.

Edit: added tag

  • 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-25T14:35:32+00:00Added an answer on May 25, 2026 at 2:35 pm

    First, describe the language in words. This language has a particularly neat description: it is the language of all strings beginning with a’s, followed by b’s, followed by a’s, where the number of b’s is equal to the total number of a’s (on both sides).

    Next, we are going to try to come up with a rule to take strings in the language and produce new strings. Given a string, you can get the next longest string by adding an a to the front and a b in the middle, or an a to the back and a b in the middle. The empty string is in this language (n = m = 0), too, so this can serve as the base for the induction. If we look at this a little closer, we can get an even better rule: we can split any string a^n b^n+m a^m into two strings (a^n b^n)(a^m b^m). Since concatenation is easy to do with grammars and a^k b^k is easy to do with grammars, that’s all there is to it.

    I get the rules…

      S := LR
      L := empty | aLb
      R := empty | bRa
    

    To get e.g. aabbba,…

      S := LR := aLbR := aaLbbR := aabbR := aabbbRa := aabbba
    

    If this is homework, tagging it as such would be good. If this is self study, hopefully you’ll take away the following tricks: describe the language in English; try to identify easy base cases; try to identify rules for forming more complicated strings (i.e. longer strings) from strings already in the language; reformulate your rules and/or notice tricks so that you can state the rules in terms of things that are easy in grammars; write the grammar and check it on a few strings.

    What is easy to do in a grammar? Union of languages, concatenation of languages, even matching of pairs of symbols (e.g. a^k b^k), palindromes, etc.

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

Sidebar

Related Questions

CGI.escapeHTML is pretty bad, but CGI.unescapeHTML is completely borked. For example: require 'cgi' CGI.unescapeHTML('…')
I have an element like this: <span class=tool_tip title=The full title>The ful&#8230;</span> This seems
I have this xml <entry id=1008 section=articles> <excerpt><p>&#8230; in Richtung „Aus für Tierversuche. Kosmetik-Fertigprodukte
so I did $subject = 'sakdlfjsalfdjslfad <a href=something/8230>lol is that true?</a> lalalala'; $subject =
what about this one: I want to format the currentTime displayed by a videoPlayer
I have been making a wordpress template. i got stuck at some place... the
I want to run this <!-- This will remove the tag --> <xsl:template name=remove-html>
An Arabic name shall be sent via SOAP. The name is encoded like this:
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Since AVD tools 16 I'm getting this warning: Replace ... with ellipsis 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.