# Recent questions tagged compiler

1
"A CLR parser will not make even single reduction before announcing an error" Plz explain this line
2
Is the set of all syntactically valid C programs countable or uncountable? How can we prove so?
3
b = b + c d = b + d b = b – d e = d + b The minimum number of nodes and edges present in the DAG representation of above basic block respectively are ? 4 and 5 5 and 4 6 and 6 6 and 7
4
If we have more than 1 parse tree,but one is LMD and other is RMD , Is Grammar Ambiguous? There are no other parse tree other than these two.
5
Consider the following translation schema S->TR R->+T{printf(“+);}R|ε T->num{printf(‘’num.val”); for the string “9+5+2” the translation schema will print? A.) 9+5+2 B.) 95+2+ C.) 952++ D.) ++952 My doubt here is: Since it is L-attributed SDT the answer should be 9+5+2 but answer given is 95+2+?
6
if grammar have two different RMDT(right most derivation tree) for a string then grammar is ambigous or not ?
7
Given the 3-address code for a basic block: The number of registers that are needed to allocate this basic block with no spills are ________.? My doubt here is : Is there any difference in question asking for minimum numbers of registers and minimum number ... If the question ask for minimum number of variables required in three address code, Only then should we optimize the code before counting?
8
backtracking is required only for top down parser? true/false
9
10
11
In compiler optimization, operator strength reduction uses mathematical identities to replace slow math operations with faster operations. Which of the following code replacements is an illustration of operator strength reduction ? A. Replace P + P by 2 * P or Replace 3 + 4 by 7 B. Replace P * 32 by P < < 5 C. Replace P * 0 by 0 D. Replace (P < <4) – P by P * 15 pls explain your answer
12
Consider the following Grammar : S -> ZZ Z -> xZ|y Which of following represent a handle in the generation of the string "xxxyxy" ? A. ZxZ B. Zxy C. xZxy D. xZ Please explain little about handles too i have little doubt in it. And do explain difference between viable prefix and Handle Please :)
13
Any transcription error can be repaired by (a) insertion alone (b) deletion alone (c) insertion and deletion alone (d) replacement alone
14
Is LR(0) grammar can generate same languages as LR(1) grammar can generate?
15
Three address codes can be implemented by (a) indirect triples (b) direct triples (c) quadruples (d) none of the above
16
Access time of the symbol table will be logarithmic, if it is implemented by a (a) linear list (b) search tree (c) hash table (d) none of the above
17
For which of the following situations, inherited attribute is a natural choice? (a) Evaluation of arithmetic expression (b) Keeping track of variable declaration (c) Checking for the correct use of L-values and R-values (d) All of the above
1 vote
18
Whether a given pattern constitutes a token or not (a) depends on the source language (b) depends on the target language (c) depends on the compiler (d) none of the above comment is true
19
1.Given a Grammar G {S}, {a, b}, S, Pwith P defined as: S  aSb, S  (i) Obtain a sentence in language generated by G and the sentential form. (ii) Obtain the language L(G). 2. Find regular expressions over {a, b} for the language defined as follows: L1 = ... parsing table for this grammar. Grammar G3 : S aBa B bB / ᶓ (b) Show that Grammar G2 is left-recursive. Grammar G2 : S S(S) S ᶓ
20
21
If I have the grammar : E->E*F | F+E |F F->id , Now here although + and * are defined at the same level , with different associativity but this grammar produces 2 different parse trees for the string id+id*id , so here we can't make any generalization regarding precedence of the operators although they are defined at the same level . So what conclusion can be drawn from this ?
22
$\text{What is three address code representation of this ?}$ -a+b|c^d^e*f|g
23
plz help me why c option wrong
1 vote
24
plz explain
25
Consider the following statements: S1 : Three-address code is a linearized representation of syntax tree. S2 : The syntax tree not depicts the natural hierarchical structure of source programm. Which of the following is true? plz explain s1 statement
26
what is semantic stack? and where it is used?
1 vote
27
What is the first and follow of this grammar?