3 votes 3 votes Consider the syntax-directed translation given by the following grammar and semantic rules. Here, $S$ is the only non-terminal and $\Sigma=\{0,1,2\}$ is a set of terminals. $\text{S.val}$ denotes the synthesized attribute (a numeric value) associated with a non-terminal $S$, and $S_1$ denotes occurrences of $S$ on the right-hand side of a production. Which of the following is/are true for the given translation scheme? The value computed by the translation scheme for the input string $201$ is $19.$ The translation scheme converts the input string over $\Sigma=\{0,1,2\}$ to base- $10$ value. The translation scheme converts the input string over $\Sigma=\{0,1,2\}$ to base- $3$ value. The value computed by the translation scheme for the input string $201$ is $20.$ Compiler Design goclasses2024-mockgate-13 goclasses compiler-design syntax-directed-translation multiple-selects 2-marks + – GO Classes asked Jan 28 • retagged Jan 28 by Lakshman Bhaiya GO Classes 542 views answer comment Share Follow See 1 comment See all 1 1 comment reply GO Classes Support commented Jan 31 reply Follow Share $ \large{\colorbox{yellow}{Detailed video solution of this question with direct time stamp}}$All India Mock Test 4 - Solutions Part 1 0 votes 0 votes Please log in or register to add a comment.
2 votes 2 votes Alphabet is given {0, 1, 2} so, input string can be only in base 3 if alphabet given would be {0,1,2,3,4,5,6,7,8,9} then it would have been in base 10. So, options A and B are TRUE. Philosophical_Virus answered Jan 29 • edited Jan 29 by Philosophical_Virus Philosophical_Virus comment Share Follow See all 3 Comments See all 3 3 Comments reply MunchyMoo commented Jan 29 reply Follow Share Oh! Thank you for the explanation! 1 votes 1 votes ritam_mandal commented Jan 29 reply Follow Share Why base 10 and not base 3. Pls explain elaborately. 0 votes 0 votes MunchyMoo commented Jan 29 reply Follow Share Input alphabets are from range 0 to 2. Hence input cannot be in base 10. Input is basically base 3. So 201 is our base 3 input, and the answer from the above grammar and semantic rules we get 19. 201 (base 3) when converted to base 10 we get 19 [ 1 + 2*9 =19 ]. 1 votes 1 votes Please log in or register to add a comment.