engineering recuitment NIC NIELIT Scientist B 2023 Mock Test Compiler Design Intermediate Code Generation Syntax Tree
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 print1
5 + 3 + 1
2
5 3 + 1 +
3
5 3 1 + +
4
+ + 5 3 1