search
Log In
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.

Recent questions tagged compiler-design

0 votes
0 answers 13 views
In the following gate 2021 question from compiler design, https://gateoverflow.in/357425/gate-cse-2021-set-1-question-26 suppose option C is modified as : The actions can be used to type-check syntactically correct boolean variable declarations BUT NOT boolean expressions. ... separate semantic rule using the production D → bool ID. Then, will option C be correct in addition to option B ?
asked Jun 1 in Compiler Design debendra2021 5 points 13 views
0 votes
1 answer 21 views
S → S + S {S.val = S1.val - S2.val} S → S * S {S.val = S1.val + S2.val} S → S – S {S.val = S1.val * S2.val} S → (S) {S.val = S1.val +2 } S → id The value of the attribute at the root when the following expression is evaluated using the above SDT is _____. ( (5 + 4) – 8) + 12
asked May 31 in Compiler Design Raj_XR 5 points 21 views
0 votes
0 answers 5 views
Consider the basic block given below: a=10 b=4*a t1=i*j c=t1+b t2=15*a d=t2*c e=i t3=e*j t4=i*a c=t3+t4 The minimum number of nodes present in the DAG representation of the above basic block is _____.
asked May 28 in Compiler Design bg_kenZ 5 points 5 views
0 votes
0 answers 10 views
0 votes
0 answers 7 views
Draw the canonical collection of lr(0) item s-->da|ab a-->ba|c B-->bB|c. Find out whether the grammar is LR(0) or not and SLR(1) or not.
asked Apr 3 in Compiler Design Prubhtej_9 5 points 7 views
0 votes
0 answers 21 views
Caption
asked Mar 12 in Compiler Design Pradeep Verma 5 points 21 views
8 votes
6 answers 3.1K views
Consider the following $\text{ANSI C}$ program: int main () { Integer x; return 0; } Which one of the following phases in a seven-phase $C$ compiler will throw an error? Lexical analyzer Syntax analyzer Semantic analyzer Machine dependent optimizer
asked Feb 18 in Compiler Design Arjun 257 points 3.1K views
0 votes
3 answers 1.2K views
In the context of compilers, which of the following is/are $\text{NOT}$ an intermediate representation of the source program? Three address code Abstract Syntax Tree $\text{(AST)}$ Control Flow Graph $\text{(CFG)}$ Symbol table
asked Feb 18 in Compiler Design Arjun 257 points 1.2K views
3 votes
2 answers 1K views
Consider the following $\text{ANSI C}$ code segment: z=x + 3 + y->f1 + y->f2; for (i = 0; i < 200; i = i + 2) { if (z > i) { p = p + x + 3; q = q + y->f1; } else { p = p + y->f2; q = q + x + 3; } } Assume that the variable $y$ points to ... the form $\textsf{ y ->f1}$ or $\textsf{y ->f2}$) in the optimized code, respectively, are: $403$ and $102$ $203$ and $2$ $303$ and $102$ $303$ and $2$
asked Feb 18 in Compiler Design Arjun 257 points 1K views
1 vote
3 answers 458 views
For a statement $S$ in a program, in the context of liveness analysis, the following sets are defined: $\text{USE}(S)$ : the set of variables used in $S$ $\text{IN}(S)$ : the set of variables that are live at the entry of $S$ $\text{OUT}(S)$ : the set of variables that are live at the ... $) }\cup \text{ OUT ($S_2$)}$ $\text{OUT ($S_1$)} = \text{USE ($S_1$)} \cup \text{IN ($S_2$)}$
asked Feb 18 in Compiler Design Arjun 257 points 458 views
0 votes
1 answer 553 views
Consider the following augmented grammar with $\{ \#, @, <, >, a, b, c \}$ ... $I_0 = \text{CLOSURE}(\{S' \rightarrow \bullet S\})$. The number of items in the set $\text{GOTO(GOTO}(I_0<), <)$ is ___________
asked Feb 18 in Compiler Design Arjun 257 points 553 views
1 vote
2 answers 754 views
Consider the following statements. $S_1:$ Every $\text{SLR(1)}$ grammar is unambiguous but there are certain unambiguous grammars that are not $\text{SLR(1)}$. $S_2:$ For any context-free grammar, there is a parser that takes at most $O(n^3)$ time to parse a string of length $n$. ... $S_2$ is false $S_1$ is false and $S_2$ is true $S_1$ is true and $S_2$ is true $S_1$ is false and $S_2$ is false
asked Feb 18 in Compiler Design Arjun 257 points 754 views
1 vote
2 answers 1.1K views
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation $\text{(SDT)}$ ... The actions can be used to type-check syntactically correct boolean variable declarations and boolean expressions. The actions will lead to an infinite loop
asked Feb 18 in Compiler Design Arjun 257 points 1.1K views
3 votes
2 answers 477 views
Consider the following context-free grammar where the set of terminals is $\{a,b,c,d,f\}$ ... $\boxed{1}\;\text{blank} \qquad \boxed{2}\;\text{S} \rightarrow \text{R}f \qquad \boxed{3}\; \text{blank} \qquad \boxed{4}\;\text{blank} $
asked Feb 18 in Compiler Design Arjun 257 points 477 views
1 vote
2 answers 537 views
Consider the following $C$ code segment: a = b + c; e = a + 1; d = b + c; f = d + 1; g = e + f; In a compiler, this code segment is represented internally as a directed acyclic graph $\text{(DAG)}$. The number of nodes in the $\text{DAG}$ is _____________
asked Feb 18 in Compiler Design Arjun 257 points 537 views
1 vote
0 answers 21 views
Can we generate different parsing table for grammar
asked Feb 14 in Compiler Design SHWETA RAO 9 points 21 views
0 votes
0 answers 19 views
Consider the following grammar S → S ; T | T T → s Construct DFA of LR(1) Items Show the parsing stack for the input string s;s;s
asked Feb 10 in Compiler Design ruqyya 5 points 19 views
0 votes
1 answer 32 views
Identify lexical, syntax and semantic errors from the following C program. Write line number, error message, and type of the error for each error in the program 01: float Factorial(int N) { 02: float F; 03: F==1; 04: while(i<F) 05: F*=i; 06: return F 07: } 08: Void mane() 09: integer r; 10: r=Factorial(5); 11: IF(r>0) 12: PrintResult(r); 13: }
asked Feb 10 in Compiler Design ruqyya 5 points 32 views
1 vote
0 answers 37 views
How to solve it?
asked Jan 29 in Compiler Design Parth27 163 points 37 views
0 votes
0 answers 50 views
(i) if a non token were in the code would it be counted in the lexical analysis? (ii) and will it generate an error in the lexical analysis phase or simply ignore that and count rest of the tokens? like, in this code : ifx = 12*54; what would be the output from lexical analysis phase?
asked Jan 26 in Compiler Design 5andy 5 points 50 views
0 votes
0 answers 28 views
what are the minimum number of registers required without any register splitting in following case c=a+b; d=a+b; as we can see at instruction 1, a and b are live c is dead at instruction 2 also a and b are live d is dead how many min register are required? ... required only. so according to that only 2 variable at max are live at any point so 2 register should be required..what would be the answer
asked Jan 23 in Compiler Design Sneha negi 9 points 28 views
0 votes
1 answer 14 views
Consider the basic block given below. u=u+v v=v+w x=v-w y=v-x z=u+v Find the sum of the minimum no of edges and nodes present in the DAG representation of the basic block given above.
asked Jan 22 in Compiler Design Divyanshu Shukla 1 point 14 views
0 votes
1 answer 30 views
Choose the correct output when the lexical analyzer scans the following input: “cabacccab”.
asked Jan 21 in Compiler Design Divyanshu Shukla 1 point 30 views
0 votes
0 answers 19 views
Answer will 8 or 9? i got 9 (according to me no optimization should be done in Intermediate representation form)
asked Jan 13 in Compiler Design Nitinkumar.097 13 points 19 views
0 votes
0 answers 82 views
The question on madeasy test: find out number of temp variables in the 3AC generated for this expression x = (-b + sqrt(b^2 - 4*a*c)) / (2*a) The answer on madeasy makes sense (screenshot below), but in this nptel video - (1 min 30th second) https://www.youtube.com/watch?v ... ) or the 2nd (nptel and wikipedia method): 1. ** 2. **where Tn-1 is √(b^2 - 4ac), and Tn is the nth temporary variable
asked Dec 30, 2020 in Compiler Design rish-18 9 points 82 views
0 votes
0 answers 17 views
S->AB A->a B->b is ambiguous or not ? i think not ambiguous becz not having two same left most derivation tree or not hab=ving two same RMD tree…...is it correct
asked Dec 28, 2020 in Compiler Design eyeamgj 29 points 17 views
0 votes
0 answers 16 views
https://gateoverflow.in/89082/gate1989-8b WHAT IS CORRECT ANSWER PLEASE SEE…. I M GETTING 0
asked Dec 25, 2020 in Programming eyeamgj 29 points 16 views
1 vote
1 answer 25 views
x=x*x y=y*y x=x*y y=y*x Minimum number of total variables in single static assignment for above code?
asked Dec 15, 2020 in Compiler Design BHOJARAM 13 points 25 views
0 votes
0 answers 65 views
Anyone please clarify.
asked Dec 14, 2020 in Compiler Design Shivateja MST 45 points 65 views
0 votes
1 answer 53 views
Anyone please clarify why lexical error is generated.
asked Dec 13, 2020 in Compiler Design Shivateja MST 45 points 53 views
0 votes
0 answers 13 views
Which of the following is/are not the functions of Syntax analyzer ? Recognize the language and to call the appropriate action routines that will generate the intermediate form or matrix for these constructs. Build a literal table and an identifier table Build a uniform symbol table Parse the source program into basic elements or tokens of the language. Anyone please clarify.
asked Dec 13, 2020 in Compiler Design Shivateja MST 45 points 13 views
0 votes
0 answers 28 views
Can anyone help me with this? How am I supposed to test whether these are viable prefixes of some handle when I am not even given any test string which can be derived from the above grammar? Please help! Thanks in advance.
asked Dec 12, 2020 in Compiler Design sankalpmittal 41 points 28 views
0 votes
0 answers 37 views
I don’t understand it at all, if someone can elaborate these options then it would be a great help.
asked Dec 8, 2020 in Compiler Design luc_Bloodstone 19 points 37 views
0 votes
1 answer 50 views
Here answer seems to be option A but given as D. Anyone please clarify
asked Dec 8, 2020 in Compiler Design Shivateja MST 45 points 50 views
0 votes
1 answer 101 views
Consider the following statements : S1) Three Address Code is a linearized representation of syntax tree S2) With triples representation optimization can change execution order. Which of the above is correct ? only S1 only S2 both S1 and S2 None of the above Anyone please clarify.
asked Dec 8, 2020 in Compiler Design Shivateja MST 45 points 101 views
0 votes
0 answers 31 views
Prove that 1. “There are DCFLs which doesnot have an LL(k) grammar” “For any DCFL, we can always have an LR(1) grammar”
asked Dec 5, 2020 in Compiler Design SHIV_KANNAUJ 9 points 31 views
0 votes
0 answers 26 views
S→ ABA A→ Bc|dA|epsilon B→ eA How many entries have multiple productions in LL(1) table? ans given is 1. but i am getting 2 In answer Follow(A)={c,e,$} but according to me it should be {c,d,e,$}
asked Dec 3, 2020 in Compiler Design 404 found 37 points 26 views
0 votes
1 answer 43 views
can someone tell why is First(B)={b,a,ε} here?? why ‘c’ is not included
asked Nov 26, 2020 in Compiler Design Ashutosh777 -219 points 43 views
0 votes
0 answers 24 views
No grammar with empty production can be LR(0)?? Is the statement true
asked Nov 26, 2020 in Compiler Design Ashutosh777 -219 points 24 views
...