Question

Consider the following grammar (A and B are non-terminals) A → A a | B |...

Consider the following grammar (A and B are non-terminals)

A → A a | B | B d

B → b d | b

Are there any ambiguities? If so, please give an example.

Homework Answers

Answer #1

Considering the grammers,the parse tree of the gramer is as follows,

A → A a | B | B d

B → b d | b

Here ,considering the string "bd",we get two parse tree using this grammer.

since two different parse tree exists,the grammer is ambigious.

A grammer is said to ambiguious ,if there is more than one Left most derivation or more than Right most derivation or more than one parse tree exists.Here the grammer is ambigiuous.

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
Consider the following grammar. Nonterminals are lowercase and terminals are uppercase. s -> c A c...
Consider the following grammar. Nonterminals are lowercase and terminals are uppercase. s -> c A c -> c B | B Which of the following sentences is in the language generated by the grammar? a) BAA b) BBBA c) BBAAAAA d) none of the above
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
The grammar below generates Boolean expressions in prefix notation: B → O B B | not...
The grammar below generates Boolean expressions in prefix notation: B → O B B | not B | id O → and | or a) Write an attribute grammar to translate Boolean expressions into fully parenthesized infix form. For example, expression and and a or b c d turns into the following fully parenthesized expression ((a and (b or c)) and d). b) Now write an attribute grammar to translate the Boolean expressions into parenthesized expressions in infix form without...
True or False If a non-terminal symbol appears at the end of the right-hand side of...
True or False If a non-terminal symbol appears at the end of the right-hand side of a rule, its Follow set contains the entire Follow set of the symbol on the left-hand-side of the rule. If a grammar has no Nullable non-terminals, the Follow sets can be ignored when computing the predict table. If A → BaBa is a rule and First(B) = {a}, then Predict(A,a) should contain A → BaBa. If no cell of the predict table for a...
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...
Construct the LR parsing table for the following grammar: S → b b
Construct the LR parsing table for the following grammar: S → b b
Consider the grammar G with productions as follows: S → AD | BC A → a...
Consider the grammar G with productions as follows: S → AD | BC A → a B → b C → a | AS | BE D → b | BS | AF E → CC F → DD Use the CYK algorithm to test membership of abbaba.
Construct the LR parsing table for the following grammar: S → b S b
Construct the LR parsing table for the following grammar: S → b S b
Convert the following CFL grammar to an equivalent grammar in Chomsky normal form. A → BAB...
Convert the following CFL grammar to an equivalent grammar in Chomsky normal form. A → BAB | B | ε B → OO | ε
Answer the following question? A-The terminals of a certain battery are labeled a and b. The...
Answer the following question? A-The terminals of a certain battery are labeled a and b. The battery voltage is v(ab)=12 V. To increase the chemical energy stored in the battery by 600J, Should the electrons move from a to b or from b to a? B- Knowing that short circuit is no matter what the current is, the voltage is zero. How come that there is a current if there is no voltage? Please provide sufficient details especially for part...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT