In: Computer Science
S -> A1B
A -> 0A | ε
B -> 0B | 1B | ε
strings (3): 1, 0011, 01010
E -> E + T | T
T -> T x F | F
F -> (E) | a
strings (3): a, a x a, (a) + a x a,
S -> (S) | [S] | SS | ε
strings (3): ( ), [ ] ( ), ( [ ] )
R1:S-> A1B
R2:A-> 0A
R3:A->ε
R4:B-> 0B
R5:B->1B
R6:B->ε
For string- 1
First we must use R1 because S is starting symbol
S -> A1B {leftmost variable is A therefore used R3}
=>1B { there is only one variable B used R6}
=>1 Answer
For String 0011
S -> A1B {R1}
=>0A1B {Leftmost variable is A used used R2}
=>00A1B {Leftmost variable is A used used R2}
=>001B {Leftmost variable is A used used R3}
=>0011B { there is only one variable B used R5}
=>0011 {there is only one variable B used R6}
S==>0011 Answer