retagged by
542 views
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?

  1. The value computed by the translation scheme for the input string $201$ is $19.$
  2. The translation scheme converts the input string over $\Sigma=\{0,1,2\}$ to base- $10$ value.
  3. The translation scheme converts the input string over $\Sigma=\{0,1,2\}$ to base- $3$ value.
  4. The value computed by the translation scheme for the input string $201$ is $20.$
retagged by

1 Answer

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.

Answer:

Related questions