Question: Help me with this please Context Free Grammars 1) Consider the following Grammar over alphabet: ={a,+,x,(,)} E -> E+T|T T -> T+F|F F ->(E)|a a)
Help me with this please
Context Free Grammars
1) Consider the following Grammar over alphabet: ={a,+,x,(,)}
E -> E+T|T
T -> T+F|F
F ->(E)|a
a) Give derivations for the following strings: a, a+a, (a)
b) Give parse trees for the following string:
a + a x a
2) Consider the grammar S -> aS | aSbS |
Show that the grammar is ambiguous by finding 2 different parse trees for the string aab
3) Give a grammar for the following languages:
a) L1 = {w|wcontains at least three 1s}
b) L2 = {w | length of w is odd}
c) L3 = {w | length of w is odd and the middle symbol is 1}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
