2,349 views
1 votes
1 votes
Consider the SDT , where S ->TR, R-> +TR|empty {print ("+")} , And T-> num {print(num)} And if the input is given "9+5+2" What is output ?

3 Answers

Best answer
1 votes
1 votes
Input 952++
S-> TR

-> 9 R (print 9 by T -> num)
-> 9 +TR (R -> +TR)
-> 9 + 5 R (print 5 by T -> num)
-> 9 + 5 + TR (R -> +TR )
-> 9 + 5 + 2 R (print 2 by T-> num)
-> 9 + 5 + 2 (print + by R -> empty)
-> 9 + 5 + 2 (print + by R -> empty)

So, answer is 952++.
selected by
2 votes
2 votes

Answer is 95+2+ 
See this -

Related questions

0 votes
0 votes
2 answers
1
3 votes
3 votes
3 answers
2
1 votes
1 votes
2 answers
4
shekhar chauhan asked Jun 5, 2016
982 views
Either L attribute or S attributed .What kind of SDT it is ?S ->E# Out('#')E - E+E Out('+')E ->TT - T#F Out('*)T - FF - (E)F - a Out ('a')For the sentence...