Question

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

Homework Answers

Answer #1

Solution:

Given grammar,

S -> TT | U

T -> 0T | T0 | #

U -> 0U00 | #

Explanation:

I have explained each and every part with the help of image attached to the answer above.

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
Construct a DFA from the following context-free grammar: T -> ε T -> (T) Draw the...
Construct a DFA from the following context-free grammar: T -> ε T -> (T) Draw the corresponding LR(0) parse table.
Solve the following context-free grammar G: 0 S--> L$ 1 L--> TL 2 L -->  ε 3...
Solve the following context-free grammar G: 0 S--> L$ 1 L--> TL 2 L -->  ε 3 T--> x Draw LR(0) parse table and SLR parse table. What kind of conflict does G have in its LR(0) parse table table and SLR parse table? What kind of conflict does G have in its LR(0) parse table table and SLR parse table?
Ex#5: Given the following grammar for a simple assignment statements. <assign> --> <id> = <expr> <id>...
Ex#5: Given the following grammar for a simple assignment statements. <assign> --> <id> = <expr> <id> --> A | B | C <exp> --> <id> + <expr> | <id> * <expr> | (<expr>) | <id> Show a leftmost derivation and a parse tree of the following statement: A = A *(B + (C * A))
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...
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...
Context Free Grammars and Parse Trees Write a grammar rule for parsing an ifStatement. Specifically, you...
Context Free Grammars and Parse Trees Write a grammar rule for parsing an ifStatement. Specifically, you should consider the following: an ifStatement should Start with the ‘if’ keyword, Require parenthesis around the condition, Can have any expression for the condition (you do not need to write a rule for expressions, you can assume one exists named expression), The condition is followed by the ‘then’ keyword, Which is followed by zero or more statements (you do not need to write 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...
Given the following grammar G = (V, T, S, P) where S is the starting symbol....
Given the following grammar G = (V, T, S, P) where S is the starting symbol. (1) S → aS (2) S → aD (3) D → bD (4) D → λ (a) Give two strings of different lengths that are generated from G (b) Give two strings that cannot be generated from G (c) What is the language generated by G, that is L(G)
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
Please show work. Consider a two-period binomial tree with the following parameters: S = 100, u...
Please show work. Consider a two-period binomial tree with the following parameters: S = 100, u = 1:20, d = 0:80, and R = 1:10. Suppose also that a dividend of $5 is expected after one period. Find the tree of prices of a European Put option with a strike of 100 expiring in two periods. Find the tree of prices of an American Put option with a strike of 100 expiring in two periods. Is there a difference between...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT