Consider the translation schema below:

S → TR

R → +T{print (‘+’);}R|ϵ

T → num {print (num.value);}

num is a token that represents an integer and num.val represents integer value. For an input ‘5 + 3 +1’, it will print

1
5 + 3 + 1
2
5 3 + 1 +
3
5 3 1 + +
4
+ + 5 3 1

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation