Question

In: Computer Science

1. Remove left recursions if any A -> Aab | abA | ab B -> bb...

1. Remove left recursions if any

A -> Aab | abA | ab
B -> bb | Bb | bB

Solutions

Expert Solution

Solution:

Left Recursion:

If a grammar contains the Productions of the form A --> Aα / β it is called Left Recursive grammar.

Left Recursion can be eliminated by the two Productions

A --> β A1

A1  --> α A1 /  ξ

The Given Grammar is:

A --> Aab / abA/ab

B --> bb / Bb /bB

First take ,

A --> Aab / abA/ab here left recursion production is : A --> Aab / ab ( A--> abA is not left recursive)

Elimination of Left Recursion is : A --> Aab / ab

here ab=α(alpha)/ β(beta) ie ab

using the following productions: A --> abA1

  A1 --> abA1  / ξ (epsilon)

where as alpha (α) = ab and beta(β) = ab

Next take the production B --> bb / Bb /bB

Here left Recursion is : B --> Bb / bb ( B--> bB is not left Recursive)

Elimination of Left Recursion is :B --> Bb / bb

here b=α(alpha)/ β(beta) ie bb

using the following productions: B --> bbB1

  B1--> bB1 / ξ (epsilon)

where as alpha (α) = b and beta(β) = bb

  

  


Related Solutions

(a)  Let S = {a, b, ab, aba}. How many different factorizations are there of (ab)11 ? It is not enough to...
(a)  Let S = {a, b, ab, aba}. How many different factorizations are there of (ab)11 ? It is not enough to give me a number. You need to prove (i.e., justify or explain very carefully) that your number is correct.  This is for an automated languages course
Let G be a group, show that: |a^{-1}ba| = |aba^{-1}| = a for all a,b in...
Let G be a group, show that: |a^{-1}ba| = |aba^{-1}| = a for all a,b in G.
The following reaction was monitored as a function of time: AB→A+B A plot of 1/[AB] versus...
The following reaction was monitored as a function of time: AB→A+B A plot of 1/[AB] versus time yields a straight line with slope 5.7×10−2 (M⋅s)−1 . Part A What is the value of the rate constant (k) for this reaction at this temperature? Express your answer using two significant figures. Part B Write the rate law for the reaction. Part C What is the half-life when the initial concentration is 0.59 M ? Express your answer using two significant figures....
Parent 1: AA Bb cc Parent 2: Aa Bb Cc A, B, and C are dominant....
Parent 1: AA Bb cc Parent 2: Aa Bb Cc A, B, and C are dominant. How many distinct phenotypes could be produced?
In 150- 200 words, describe different single subject case designs a. Describe AB, ABA, ABAB, multiple...
In 150- 200 words, describe different single subject case designs a. Describe AB, ABA, ABAB, multiple baseline, and alternating treatments design b. Give an example of how you could use this design c. Pick two designs to compare. Why would you choose one design over the other?
Let R=R+. Define: a+b = ab ; a*b = a^(lnb) 1. Is (R+, +, *) a...
Let R=R+. Define: a+b = ab ; a*b = a^(lnb) 1. Is (R+, +, *) a ring? 2. If so is it commutative? 3. Does it have an identity?
The member AB is supported at B by a cable and at A
The member AB is supported at B by a cable and at A by a smooth fixed square rod which fits loosely through the square hole of the collar. If F= {20i - 40j - 75k} lb, determine the x, y, and z components of the reaction at A and the tension in cable BC. (Note: possible reactions at Aare Ay, Ax, Mx, My, and Mz).
Generate a random variable with Pareto(a, b) distribution with PDF given by f(x) = (aba)/(xa+1)
Generate a random variable with Pareto(a, b) distribution with PDF given by f(x) = (aba)/(xa+1)
1 A and B form the AB partnership. According to the agreement, A contributed $70,000 in...
1 A and B form the AB partnership. According to the agreement, A contributed $70,000 in cash while B contributed $80,000. Make the journal entry to form the partnership under the following assumptions: a) The agreement was silent about allocating capital balances. b) The agreement specified that capital balances will be allocated equally and the bonus method will be used. c) The agreement specified that capital balances will be allocated equally and the goodwill method will be used. 2 Using...
The reaction AB(aq)→A(g)+B(g) is second order in AB and has a rate constant of 0.0249 L⋅mol−1⋅s−1...
The reaction AB(aq)→A(g)+B(g) is second order in AB and has a rate constant of 0.0249 L⋅mol−1⋅s−1 at 25.0 ∘C. A reaction vessel initially contains 250.0 mL of 0.180 mol⋅L−1 AB which is allowed to react to form the gaseous product. The product is collected over water at 25.0 ∘C. Part A How much time is required to produce 270.0 mL of the products at a barometric pressure of 736.7 mmHg . (The vapor pressure of water at this temperature is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT