Question

Consider the following grammar S -> A M M -> S | A -> a E...

Consider the following grammar

S -> A M
M -> S
   |
A -> a E
   | b A A
E -> a B
   | b A
   |
B -> b E
   | a B B

Show a derivation for the string a b a a. Start with

S => A M
  => ...

and in each step replace one nonterminal by the right-hand side of a grammar rule until you end up with the symbols a b a a on a line by itself. Underline the nonterminal you are expanding and write the expanded line underneath.

Homework Answers

Answer #1

The above problem is all about deriving a given string from the given grammar.

we can derive the strings from the grammar by substituting the terminals in place of non terminals .

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question 1 Consider the following grammar G: S ➝ A B C | A C |...
Question 1 Consider the following grammar G: S ➝ A B C | A C | A | B A ➝ a B B ➝ b C | a C ➝ c D D ➝ d A Recall that a non-terminal A is reachable if there is a derivation starting from S in which A appears: S ⇒* x A y holds for some x and y which are sequences of terminals and non-terminals (possibly empty). For example, if there...
Consider the following context-free grammar: S → TT | U T → 0T | T0 |...
Consider the following context-free grammar: S → TT | U T → 0T | T0 | # U → 0U00 | # a. Give a parse tree for the string: 0#0#0 b. Give a leftmost derivation for the string: 00#0000
Automata Theory and Formal Languages Problems 1: Consider the following two grammars. Grammar G1- S →...
Automata Theory and Formal Languages Problems 1: Consider the following two grammars. Grammar G1- S → aSb / ∈ Grammar G2- S → aAb / ∈, A → aAb / ∈ a. is G1=G2 b. What is the grammar generated by the expression Problem 2: Let us consider the grammar. G2 = ({S, A}, {a, b}, S, {S → aAb, aA → aaAb, A → ε } ) Derive aaabbb Problem 3: Suppose we have the following grammar. G: N...
Write a BNF grammar for a new language called 4040. It should include the following rules:...
Write a BNF grammar for a new language called 4040. It should include the following rules: Variable definitions should start with var. There must be only single space after var. Variable names should come after the var and single space. Variable names should start with a letter or underscore(_). Starting with a digit is not allowed. Variable names can have digits after the first letter. There can be multiple variable names separated by comma. Between variables, spaces are allowed. There...
For the following equations: ?E = − 6.0 cos 45° m/s + 3.0 m/s, ?L =...
For the following equations: ?E = − 6.0 cos 45° m/s + 3.0 m/s, ?L = 6.0 sin 45° m/s a. Write a realistic problem for which these are the correct equations. b. Finish the problem, including a pictorial representation.
1. Consider the following electrochemical cell at 298.15 K: Mg(s) | MgSO4 (aq, m = 0.30)...
1. Consider the following electrochemical cell at 298.15 K: Mg(s) | MgSO4 (aq, m = 0.30) || AgNO3 (aq, m = 0.50) | Ag(s) (a) Write the half reactions and the overall reaction. (b) Calculate the standard cell potential. (c) Calculate ∆GR° and K° for the overall reaction. (d) Calculate the cell potential and ∆GR assuming activity coefficients are 1.00. (e) Calculate the cell potential and ∆GR using Table 10.3 for the mean ionic activity coefficients.
Consider the following apparatus for measuring the charge per mass (q/m) ratio of the proton. This...
Consider the following apparatus for measuring the charge per mass (q/m) ratio of the proton. This apparatus employs the same physics as in mass spectrometers. It consists of a pair of plates that accelerate a beam of protons starting from rest at the left-most plate to a speed of 1 x 107 m/s, followed by a velocity selector set to only pass this speed, and a final set of deflector plates. (a) The left side of the accelerator plate is...
A 0.00600 kg bullet traveling horizontally with speed 1.00 103 m/s strikes a 21.4 kg door,...
A 0.00600 kg bullet traveling horizontally with speed 1.00 103 m/s strikes a 21.4 kg door, embedding itself 11.3 cm from the side opposite the hinges as shown in the figure below. The 1.00 m wide door is free to swing on its frictionless hinges. A door shown from above such that its hinge is on the top side of the figure with the door going down. A bullet is traveling horizontally to the right towards the door on the...
Derive the following using all known inferences rules and equivalences including QE. Remember that equivalences afford...
Derive the following using all known inferences rules and equivalences including QE. Remember that equivalences afford you greater power than derivation rules, because you are permtted to substitute equivalent sub formlas within a wff. For example, all the moves on the left below are legitimate inferences even though the first conditional is the main operator. However, it is important to remember that you must always be operating on a true self-contained wff. The moves on the right are not legitimate...
Write a program of wordSearch puzzle that use the following text file as an input. The...
Write a program of wordSearch puzzle that use the following text file as an input. The output should be like this: PIXEL found (left) at (0,9). ( Use JAVA Array ) .Please do not use arrylist and the likes! Hints • The puzzle can be represented as a right-sized two-dimensional array of characters (char). • A String can be converted into a right-sized array of characters via the String method toCharArray. . A word can occur in any of 8...