Given the following syntax directed translation rules: Rule 1: 𝑅 β†’ 𝐴𝐡 {𝐡.…

GATE Β· 2025 Β· CS Β· Set 2 Β· Computer Science & IT

Given the following syntax directed translation rules:

Rule 1: 𝑅 β†’ 𝐴𝐡 {𝐡. 𝑖 = 𝑅. 𝑖 βˆ’ 1; 𝐴. 𝑖 = 𝐡. 𝑖; 𝑅. 𝑖 = 𝐴. 𝑖 + 1;}

Rule 2: 𝑃 β†’ 𝐢𝐷 {𝑃. 𝑖 = 𝐢. 𝑖 + 𝐷. 𝑖;𝐷. 𝑖 = 𝐢. 𝑖 + 2;}

Rule 3: 𝑄 β†’ 𝐸𝐹 {𝑄. 𝑖 = 𝐸. 𝑖 + 𝐹. 𝑖;}

Which ONE is the CORRECT option among the following?

  1. A.

    Rule 1 is S-attributed and L-attributed; Rule 2 is S-attributed and not L-attributed; Rule 3 is neither S-attributed nor L-attributed

  2. B.

    Rule 1 is neither S-attributed nor L-attributed; Rule 2 is S-attributed and L-attributed; Rule 3 is S-attributed and L-attributed

  3. C.

    Rule 1 is neither S-attributed nor L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed

  4. D.

    Rule 1 is S-attributed and not L-attributed; Rule 2 is not S-attributed and is L-attributed; Rule 3 is S-attributed and L-attributed

Attempted by 103 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…