edited by
1,547 views
0 votes
0 votes
For the below SDT, what will be the output for the input string aaacb?
S → aAa {print "0"}
S → b {print "1"}
A → Sc {print "2"}

How to approach as S→ aAa then how we will get the string aaacb .
edited by

2 Answers

0 votes
0 votes
Given input String is aaacb can't be generated from the above grammar since in the input string the number of a's are odd and according to the given grammar it can only produce even number of a's.

Thus given input string is not generated from the above grammar.

Related questions

1 votes
1 votes
3 answers
2
spriti1991 asked Mar 18, 2015
2,340 views
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 ?
0 votes
0 votes
2 answers
3
worst_engineer asked Sep 12, 2015
629 views
The output for SDT isE - E+E printf("+")E - a printf("a")for a + a + a is
1 votes
1 votes
2 answers
4
shekhar chauhan asked Jun 5, 2016
978 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...