1,256 views
0 votes
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
2 votes
2 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

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2
Ebrahim asked Jan 12
175 views
Q1. For the following grammar N - AB | BA A - a | CAC B - b | CBC C - a | b Find the FIRST and FOLLOW
0 votes
0 votes
0 answers
3
Ebrahim asked Jan 11
109 views
Find the FIRST and FOLLOW of the grammar to check whether it is LL (1) parser or not. N → AB | BA A → a | CAC B → b | CBC C → a | b
0 votes
0 votes
0 answers
4