retagged by
651 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

457
views
1 answers
4 votes
GO Classes asked Jan 28
457 views
Consider the following grammar$\begin{aligned}& A \rightarrow B B \\& B \rightarrow b\end{aligned}$Suppose we draw an $\operatorname{LR}(0)$ ... state with $2$ incoming transitionsThere is exactly one state with $3$ outgoing transitions
1.2k
views
2 answers
8 votes
GO Classes asked Jan 28
1,175 views
A TCP connection has been established between hosts $\text{A}$ and $\text{B. A}$ receives a packet from $\text{B}$ with the following field values shown ... Sequence: $8001$Acknowledgment: $1053$Window size: $2000$[TCP Payload Size: $1000]$
537
views
1 answers
7 votes
GO Classes asked Jan 28
537 views
For a string $x=x_1 \cdots x_n \in \Sigma^*$, where $\Sigma$ is any alphabet and $x_1, \ldots, x_n \in \Sigma$, we write $x^{\uparrow m}=x^m$ (that is, the usual ... in \Sigma^*\right\}$\left\{(a b c)^{\downarrow n} \mid n \geq 0\right\}$