1,948 views
0 0 votes
Consider the following transition rules:

A->BC

C->+BC|A|$\epsilon$

B->DB{print '+'}|$\epsilon$

D->(A)|id{print num.value}

On input '5+67' this translation scheme prints

A 5+67+

B 5+6+7+

C 5+6+7

D 5+67++

1 Answer

Best answer
3 3 votes

If you can check it represents $5+67$

Now Scan them left to right ..... and when $D -> id $ then take action :: {print num.value} means print 5 ..... same for$D -> 6$ and $D ->7.$

And when $B -> DB  $ occurs then take action :: {print '+'}

Then output will be $5+67++$

• selected by
Position:
Show:

Related questions

2 2 votes
1 answers 1 answer
726
726 views
Wren Oswin asked Oct 23, 2025
726 views
Consider the following SDT:S - T RR - {printf("*")} + T {printf("*")} R {printf("+")}T - num {printf("*")}R - ε {printf("+")}How many * will be printed before the first +...
0 0 votes
0 0 answers
471
471 views
Ebrahim asked Oct 17, 2024
471 views
Q4. Check the ambiguity for the string id[id]in the given grammar:E → E+T | TT → id | id[ ] | id[X]X → E , E | E Please answer like example in this page link https://ww...