Compiler Design
Description: Compiler Design | |
Number of Questions: 25 | |
Created by: Aliensbrain Bot | |
Tags: Compiler Design Syntax Directed Translation IES (Indian Engineering Services) Syntax directed translation Parser Basics of Code Optimization Basics of code optimization Intermediate Code Generation Intermediate code generation Compiler Optimization |
Identify the odd one out.
Number of states for a grammar in SLR parser and LALR is
Match the following. (Choose the most appropriate option) (A) S – Attributed Definition (i) Synthesized attribute (B) L _ Attributed Definition (ii) Inherited attributed
Consider the following grammar:A $\rightarrow$ BCC $\rightarrow$ +$A| \epsilon$B $\rightarrow$ id In the predictive parser table, m, of grammar the entire M [A, id] and M [C, $] respectively, is
Expression corresponding to this DAG is
The grammar E $\rightarrow$E + E |E*E|(E)| id is
Which of the following statements is false about viable prefixes?
Which of the following is generally not present in activation record?
Match the following.
i. Token | a. Character i, f, letter followed by latter and digits etc |
ii. Pattern | b. if, id, comparison |
iii. Lexeme | c. if, pi, < = |
A$\rightarrow$BCC $\rightarrow$ + B {print ('+'); }C|$\epsilon$ B$\rightarrow$ D* B {print ('*')i}|D D$\rightarrow$ (A)|id {print (id.value); } For an input '5 + 6*7' this translation scheme prints
Consider the following statements. (i) Every SLR (1) grammar is unambiguous (ii) There are many unambiguous grammars that are not SLR (1)
Eliminate left recursion S $\rightarrow$ Aa|b A $\rightarrow$Ac|Sd|f
Computer value of 5 # 9 and 3 is
Find the false statement.
Follow (E) is
The grammar
The grammar $S \rightarrow SA|A$ $A \rightarrow a$
The value printed by the following is $ (( A + B ) * C + ( D * E) + ( F *G)) $
While (i < = limit - 2) statement becomes $ \begin{cases} t=\text{limit - 2} \\ \text{While } (i \Leftarrow t) \end{cases} $ This optimization is caused by
Consider the grammar. T$\rightarrow$T*F|F F $\rightarrow$ id For a sentence id1 *id2, the handlers in the right sequential form of the reduction are
Consider the grammar with transition rule and E is the start symbol.
E $\rightarrow$ E1 $\ne$ T {E1.value = E1.value + T.value}
|T {E.value = T.value}
T $\rightarrow$ T1 & F {T.value = T1.value / F.value}
|F {T.value = F.value}
F $\rightarrow$ num {F.value = num.value}
Concept E. The value for the root of the parse tree for expression 6 # 4 and 2 # 16 and 4 is
Consider the grammar.
First ( E' ) and first ( E ) are respectively
Choose the most appropriate option. (i) Indirect triples is advantageous than triples. (ii) With indirect triple, an optimizing compiler can move an instruction by reordering the instruction list, without affecting the triples themselves.
Left factor the grammar. $A \rightarrow ad|a|ab|abc|b$
Following are the production and the action.
- $L\rightarrow E \eta$
- $E \rightarrow \{ print('+'); \}E_1 + T$
- $E \rightarrow R$
- $E \rightarrow \{ print('+'); \}T_1 + F$
- $T\rightarrow F$
- $F\rightarrow (E)$
- $F\rightarrow \text{digit \{print (digit lexval)\} }$
This is syntax directed translation for