search
Log In

Recent questions and answers in Compiler Design

28 votes
3 answers
1
Consider the translation scheme shown below. S $\rightarrow$ T R R $\rightarrow$ + T {print(‘+’);} R$\mid \varepsilon$ T $\rightarrow$ num {print(num.val);} Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string ‘$9 + 5 + 2$’, this translation scheme will print $9 + 5 + 2$ $9 \ 5 + 2 +$ $9 \ 5 \ 2 + +$ $+ + 9 \ 5 \ 2$
answered Aug 6 in Compiler Design anurag_yo 4.5k views
63 votes
9 answers
2
For a C program accessing $\mathbf{X[i] [j] [k]}$, the following intermediate code is generated by a compiler. Assume that the size of an integer is $32$ bits and the size of a character is $8$ bits. t0 = i ∗ 1024 t1 = j ∗ 32 t2 = k ∗ 4 t3 = t1 + t0 t4 = t3 + t2 t5 = X[t4] ... $\mathbf{X}$ is declared as "char $\mathbf{X[4] [32] [8]}$ . $\mathbf{X}$ is declared as "char $\mathbf{X[32] [16] [2]}$ .
answered Jul 27 in Compiler Design shetu_raj 9.3k views
17 votes
4 answers
3
Consider the grammar $S \rightarrow bSe$ $S \rightarrow PQR$ $P \rightarrow bPc$ $P \rightarrow \varepsilon$ $Q \rightarrow cQd$ $Q \rightarrow \varepsilon$ $R \rightarrow dRe$ $R \rightarrow \varepsilon$ where $S, P, Q, R$ are non-terminal symbols with $S$ being the start symbol ... $i, j, k, m$? Find the smallest string that has two parse trees.
answered Jul 24 in Compiler Design Jithendra319 1.7k views
13 votes
6 answers
4
The grammar $S\rightarrow AC\mid CB$ $C\rightarrow aCb\mid \epsilon$ $A\rightarrow aA\mid a$ $B\rightarrow Bb\mid b$ generates the language $ L=\left \{ a^{i}b^{j}\mid i\neq j \right \}$. In this grammar what is the length of the derivation (number of steps starting from $S$) to generate the string $a^{l}b^{m}$ with $l\neq m$ $\max (l,m) + 2$ $l + m + 2$ $l + m + 3$ $\max (l,m) + 3$
answered Jul 23 in Compiler Design Jithendra319 1.7k views
27 votes
3 answers
5
In a compiler, keywords of a language are recognized during parsing of the program the code generation the lexical analysis of the program dataflow analysis
answered Jul 23 in Compiler Design Asim Siddiqui 4 6.5k views
3 votes
1 answer
6
2 votes
4 answers
7
In a two-pass assembler, resolution of subroutine calls and inclusion of labels in the symbol table is done during second pass first pass and second pass respectively second pass and first pass respectively first pass
answered Jun 27 in Compiler Design tarun304 491 views
1 vote
2 answers
8
In operator precedence parsing we have the rule that production cannot have two adjacent non-terminals or an epsilon production, so this production, S--> ab is allowed but not S--> AB, A->a and B->b, though they are giving us the same output. Why so?
answered Jun 19 in Compiler Design Mohitdas 228 views
0 votes
4 answers
9
1 vote
3 answers
10
0 votes
3 answers
11
fro(int I=0; I <5;I++); what kind of compilation error is this ?
answered Jun 14 in Compiler Design pritambiswas000007 137 views
1 vote
3 answers
12
A given grammar is called ambiguous if two or more productions have the same non-terminal on the left hand side a derivation tree has more than one associated sentence there is a sentence with more than one derivation tree corresponding to it brackets are not present in the grammar
answered Jun 9 in Compiler Design pritambiswas000007 852 views
0 votes
3 answers
13
0 votes
3 answers
14
The identification of common sub-expression and replacement of run time computations by compile-time computations is: Local optimization Constant folding Loop Optimization Data flow analysis
answered Jun 9 in Compiler Design pritambiswas000007 161 views
2 votes
4 answers
17
Which of the following is the most general phase-structured grammar? (a) regular (b) context-free (c) context-sensitive (d) none of the above
answered Jun 8 in Compiler Design pritambiswas000007 701 views
2 votes
1 answer
18
I think my answer is correct..please check. i got A , Given Answer is B Solution:
answered Jun 8 in Compiler Design GATE2021 289 views
2 votes
4 answers
20
8 votes
4 answers
21
0 votes
4 answers
23
Every LL(1) grammar is ______ A.SLR(1) B.LALR(1) C.LR(1) D.Both B & C
answered Jun 6 in Compiler Design pritambiswas000007 272 views
0 votes
4 answers
24
0 votes
5 answers
25
I know the parsing logic of bottom up parsers, that they start from the terminal and reduce it to the start symbol. But what really confuses me is the construction of LR(0)/LR(1) sets : Eg : S->Sa|a Then in LR(0) set : S'->.S S->.Sa S->.a Now the dot is in front of S , so shouldn't the S production be generated again and again and make it go to an inf. loop?
answered Jun 6 in Compiler Design pritambiswas000007 2k views
19 votes
5 answers
26
Consider the following grammar (the start symbol is $E$) for generating expressions. $E \rightarrow T - E \mid T + E \mid T$ $T \rightarrow T * F \mid F$ $F \rightarrow 0 \mid1\mid 2\mid 3\mid 4\mid 5\mid 6\mid 7\mid 8\mid 9$ With respect to this grammar, which of the following trees is the valid evaluation tree for the expression $2*3*4 - 5*6+7$?
answered Jun 6 in Compiler Design pritambiswas000007 948 views
7 votes
6 answers
27
Every LL(1) grammer is LALR(1) TRUE OR FALSE Every LL(1) grammer is CLR(1) TRUE OR FALSE AS I think 2nd is True and 1st is False if I am wrong please let me correct.
answered Jun 6 in Compiler Design pritambiswas000007 3.2k views
4 votes
6 answers
28
Consider the grammar given below S⟶ SS | a | ∈ The number of inadequate states in the DFA of LR(1) items is (a) 1 (b) 2 (c) 3 (d) 4
answered Jun 5 in Compiler Design pritambiswas000007 1.5k views
0 votes
3 answers
29
0 votes
1 answer
30
In two pass assembler the symbol table is used to store : Label and value Only value Mnemonic Memory Location
answered Jun 3 in Compiler Design Mohit Kumar 6 54 views
0 votes
2 answers
31
In a single pass assembler, most of the forward references can be avoided by putting the restriction on the number of strings/lifereacts. that the data segment must be defined after the code segment. on unconditional rump. that the data segment be defined before the code segment.
answered Jun 2 in Compiler Design manoj kanwar 176 views
0 votes
4 answers
32
0 votes
3 answers
33
Which of the following statement(s) regarding a linker software is/are true ? A function of a linker is to combine several object modules into a single load module. A function of a linker is to replace absolute references in an object module by symbolic references to locations in other modules. Only I Only II Both I and II Neither I nor II
answered Jun 2 in Compiler Design manoj kanwar 73 views
0 votes
4 answers
34
Consider the following statements related to compiler construction: Lexical Analysis is specified by context-free grammars and implemented by pushdown automata. Syntax Analysis is specified by regular expressions and implemented by finite-state machine. Which of the above statement(s) is/are correct? Only I Only II Both I and II Neither I nor II
answered Jun 2 in Compiler Design manoj kanwar 189 views
0 votes
1 answer
35
What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon and unit production (i.e.,of type $A\to\epsilon$ and $A \to a)$ to parse a string with $n$ tokens? $n/2$ $n-1$ $2n-1$ $2^n$
answered Jun 1 in Compiler Design Mohit Kumar 6 59 views
1 vote
1 answer
36
1 vote
1 answer
37
https://gateoverflow.in/43605/gate1991-10c in the answer given .....it will generate a parenthesis like (id - id / id) right? will not that be redundant ?
answered May 4 in Compiler Design Karan01 97 views
60 votes
6 answers
38
The least number of temporary variables required to create a three-address code in static single assignment form for the expression $q + r / 3 + s - t * 5 + u * v/w$ is__________________.
answered May 3 in Compiler Design manikantsharma 13.2k views
1 vote
1 answer
40
Construct a syntax-directed translation scheme that translates arithmetic expressions from infix notation into prefix notation in which an operator appears before its operands; e.g., $-xy$ is the prefix notation for $x - y$. Give annotated parse trees for the inputs $9-5+2$ and $9-5*2$.
answered Apr 26 in Compiler Design Venky8 87 views
To see more, click for all the questions in this category.
...