Search results for compiler

110
views
0 answers
1 votes
1. Generate intermediate code for the following code segment. a) (x<y) and (y>z) and not z b) if(i%2==0)evensum=evensum+elseoddsum=oddsum+i;
109
views
0 answers
0 votes
directed acyclic graph(DAG)is a simplified step from the AST. Solve the following expressions by AST and DAG: X=(((a+a))+((a+a)+(a+a)))
116
views
0 answers
0 votes
Q4. Generate target code for the following source language statements : x = a + b + c * (d-e) 
88
views
0 answers
0 votes
Q2. Implement the statement a:= -b + c*(d-e) + f * (c*(d-e)) into following Intermediate code representation.  a) Quadrupleb) Triple c) Indirect Triple Solve the above Question like this example
7.1k
views
4 answers
10 votes
In the context of compilers, which of the following is/are $\text{NOT}$ an intermediate representation of the source program?Three address codeAbstract Syntax Tree $\text{(AST)}$Control Flow Graph $\text{(CFG)}$Symbol table
113
views
0 answers
0 votes
Use the semantic rules below to draw an annotated parse tree for the expression. Compute the final value. (4*2)+3+(3*3+2)n
9.7k
views
4 answers
35 votes
One of the purposes of using intermediate code in compilers is tomake parsing and semantic analysis simpler.improve error recovery and error ... machine-independent code optimizer in other compilers.improve the register allocation.
21.0k
views
7 answers
56 votes
Statement for Linked Answer Questions 83a & 83b:Consider the following expression grammar. The semantic rules for expression evaluation are stated next to each grammar ... and resolves the conflict in favor of a reduce over a shift action
20.6k
views
3 answers
17 votes
Consider the grammar given below:$S \rightarrow Aa$A \rightarrow BD$B \rightarrow b \mid \epsilon $D \rightarrow d \mid \epsilon $Let $a,b,d$ and $ ... $)$ , then the answer should be $3210$)
1.0k
views
0 answers
4 votes
The grammar shown below is LL(k) for some value of k. What is the smallest value of k for which this grammar is LL(k)?
10.5k
views
2 answers
19 votes
Consider the following C code segment. for (i = 0, i < n; i++) { for (j = 0; j < n; j++) { if (i%2) { x += (4*j + 5*i); ... in this code There is scope of strength reduction in this code There is scope of dead code elimination in this code
3.1k
views
1 answers
2 votes
Which of the following statements is/are FALSE?An attribute grammar is a syntax-directed definition $\text{(SDD)}$ in which the functions in the semantic ... $\text{LR(1)}$ grammar can be evaluated using a bottom-up parsing strategy
928
views
1 answers
2 votes
10.9k
views
3 answers
18 votes
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation ... declarations and boolean expressions.The actions will lead to an infinite loop
860
views
1 answers
4 votes
Consider the following grammar given below. ... string: $a^* b($\operatorname{CC}($\mathrm{BC}($\mathrm{CB}$\mathrm{BB}$
256
views
0 answers
0 votes
Number of nodes in the DAG(Directed Acyclic Graph) representing (a+b)+c+(a+b)
373
views
1 answers
4 votes
Consider the following given grammar and the parse tree for the sentence $x + y * z.$The first reduction made by the shift-reduce parser is labeled as 1, and we keep ... $T \rightarrow T^* P$ will be labeled 7.
26.6k
views
2 answers
57 votes
A variable $x$ is said to be live at a statement $s_{i}$ in a program if the following three conditions hold simultaneously:There exists a statement $S_{j}$ that uses $x$There is a path ... {p, s, u}$\text{r, s, u}$\text{r, u}$\text{q, v}$
2.1k
views
1 answers
0 votes
Consider the following grammar $G$, with $S$ as the start symbol. The grammar $G$ has three incomplete productions denoted by $(1), (2)$, and $(3)$ ... $T \rightarrow c T$ (3) $R \rightarrow c R$
534
views
1 answers
5 votes
$\begin{aligned}& S \rightarrow S1 \;T \\& S 1 \rightarrow a \mid(S S) \\& T \rightarrow \varepsilon \mid b \;T\end{aligned}$In the $\text{LL(1)}$ ... \{T \rightarrow \varepsilon\}$\{S 1 \rightarrow a\}$ and $\{T \rightarrow \varepsilon\}$