Search results for compiler

13.2k
views
4 answers
39 votes
Consider the translation scheme shown below.$S \rightarrow T\;R$R \rightarrow + T \{\text{print}( +');\} R\mid \varepsilon$T \rightarrow$ num $\{\text{print}$(num.val)$;\}$Here num is a ... 5 + 2$9 \ 5 + 2 +$9 \ 5 \ 2 + +$+ + 9 \ 5 \ 2$
13.4k
views
6 answers
34 votes
Consider the grammar with non-terminals $N=\left\{S,C,S_1\right\}$, terminals $T=\left\{a, b, i, t, e\right\}$, with $S$ as the start ... is NOT LL(1) because:it is left recursiveit is right recursiveit is ambiguousit is not context-free
2.8k
views
3 answers
1 votes
Consider the following two sets:Set $\text{X}$Set $\text{Y}$P. Lexical Analyzer1. Abstract Syntax TreeQ. Syntax Analyzer2. TokenR. Intermediate Code Generator3. Parse TreeS. Code ...
11.0k
views
2 answers
2 votes
Is the following grammar LL(1) ?S→ aABbCD | ϵA→ ASd | ϵB→ Sac| hC | ϵC→ Sf |CgD→ aBD | ϵDraw the LL(1) parsing table for the given grammar.
10.9k
views
2 answers
26 votes
Consider the following Syntax Directed Translation Scheme $( SDTS )$, with non-terminals $\{S,A \}$ and terminals $\{a,b \}$. $S \to aA \quad \{\text{print }1\}$ ... : $1 \ 3 \ 2 $ $2 \ 2 \ 3 $ $2 \ 3 \ 1 $ syntax error
3.0k
views
1 answers
2 votes
Consider the following augmented grammar, which is to be parsed with a $\text{SLR}$ parser. The set of terminals is $\{a, b, c, d, \#, @\}$\[\begin{ ... number of items in the set $\operatorname{GOTO}\left(I_{0}, S\right)$ is __________.
2.1k
views
1 answers
4 votes
Consider a context-free grammar $\text{G}$ with the following $3$ rules.$S \rightarrow a S, S \rightarrow a S b S , S \rightarrow c$ Let $w \in L(G)$ ... $n_{c}(w)=n_{b}(w) * 2$
7.9k
views
2 answers
4 votes
Consider the syntax directed translation given by the following grammar and semantic rules. Here $N, I, F$ and $B$ are non-terminals. $N$ is the ... for the input string$10\#011$is ____________. (Rounded off to three decimal places)
3.4k
views
1 answers
3 votes
Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table below.Operator PrecedenceAssociativity+Highest Left-HighRight*MediumRight/ ... as per the above rules is ________. 
8.4k
views
1 answers
8 votes
Consider the following program:int main() { f1 (); f2(2); f3(); return (0); } int f1 () { return(1); } int f2 (int X) { f3(); ... (5); } Which one of the following options represents the activation tree corresponding to the main function?
24.1k
views
4 answers
37 votes
The grammar $A \rightarrow AA \mid (A) \mid \epsilon$ is not suitable for predictive-parsing because the grammar is:ambiguousleft-recursiveright-recursivean operator-grammar
2.1k
views
1 answers
3 votes
Consider the following expression: $x[i]=(p+r) *-s[i]+u / w$ ... $=s i \quad(3)-(0)(2) \quad(6)=[ ] x i$
19.8k
views
7 answers
60 votes
The minimum number of arithmetic operations required to evaluate the polynomial $P(X) = X^5+4X^3+6X+5$ for a given value of $X$, using only one temporary variable is ______.
2.3k
views
1 answers
0 votes
Consider the following pseudo-code.$L 1 : t 1 = -1$ $L 2: t 2 = 0$ $L 3: t 3 = 0$ $L 4: t 4 = 4 * t 3$ ... $ and $6$6$ and $7$7$ and $7$7$ and $6$
3.4k
views
1 answers
2 votes
Consider the following context-free grammar where the start symbol is $\text{S}$ and the set of terminals is $\{a, b, c, d\}$ ... $(2)$ $S \rightarrow A a A b$ $(3)$ blank $(4)$ blank
66
views
0 answers
1 votes
S -> i E t S S' | aS' -> e S | ϵE -> bHow to convert this grammar to LL(1) grammar?
250
views
2 answers
0 votes
S -> A BA -> f S fA -> b b B dB -> ƐB -> cFirst(S) =First(A) =First(B) =Follow(S) =Follow(A) =Follow(B) =
178
views
2 answers
0 votes
S -> A BA -> f S fA -> b b B dB -> ƐB -> cFirst(S) =First(A) =First(B) =Follow(S) =Follow(A) =Follow(B) =
10.6k
views
6 answers
28 votes
To evaluate an expression without any embedded function callsOne stack is enoughTwo stacks are neededAs many stacks as the height of the expression tree are neededA Turing machine is needed in the general case
12
views
0 answers
0 votes