MCQOPTIONS
Bookmark
Saved Bookmarks
→
Compiler Design
→
Compiler design miscellaneous
→
Consider the grammar shown below:
1.
Consider the grammar shown below:
A.
{S e S} and {S }
B.
{S e S} and {}
C.
{S } and {S }
D.
{S e S, S } and {S }
Answer» E.
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
Consider a program P that consists of two source modules M1 and M2 contained in two different files. If M1 contains a reference to a function defined in M2, the reference will be resolved at
Consider the basic block given below. a = b + c c = a + d d = b + c e = d - b a = e + b The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are
Given the following expression grammar E E * F | F + E | F E F | id Which of the following is true?
Consider the following translation scheme: S FR R *E{print ( * ); R | E F + E {print ( + ); |F F (S)| id {print (id. value);} Here, id is a token that represents an integer and id value represents, the corresponding integer value. For an input 2 * 3 + 4 , this translation scheme prints.
Consider the syntax directed translation scheme (SDTS) given in the following. Assume attribute evaluation with bottom-up parsing, i.e., attributes are evaluated immediately after a reduction. E E1 * T {E.val = E1 .val * T. val} E T {E.val = T. val} T F T1 {T.val = F.val T1. val} T F {T.val = F. val} F 2 {F.val = 2} F 4 {F.val = 4} (a) Using this SDTS, construct a parse tree for the expression 4 2 4 * 2 and also compute its E.val. (b) It is required to compute the total number of reductions performed to parse a given input. Using synthesized attributes only, modify the SDTS given, without changing the grammar, to find E.red, the number of reductions performed while reducing an input to E.
Consider the translation scheme shown below: S RT R + T {print ( + :) R/ T num {print (num. val);} Here, num is a taken that represents an integer and num. val represents the corresponding integer value. For an input string 9 + 5 + 2 , this translation scheme will print
Which of the following statements are CORRECT? (1) Static allocation of all data areas by a compiler makes it impossible to implement recursion. (2) Automatic garbage collection is essential to implement recursion. (3) Dynamic allocation of activation records is essential to implement recursion. (4) Both heap and stack are essential to implement recursion.
Consider the grammar shonws below :S CC C cc/ d This grammar is
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); Y + = (7 + 4 * j);}}} Which one of the following is false?
In a simplified computer, the instructions are OP Rj, Ri Performs Rj OP Ri and stores the result in register Ri . OP m, Rj Performs val OP Ri and stores the result in Rj. val denotes the content of memory location m. MOV m, Ri Moves the content of memory location m to register Ri. MOV, Ri, m Moves the content of the register Ri to memory location m. The computer has only two registers, and OP is either ADD or SUB. Consider the following basic block: t1 = a + b t2 = c + d t3 = e t2 t4 = t1 t3Assume that all operands are initially in memory. The final value of the computation should be in memory. What is the minimum number of MOV instructions in the code generated for this basic block?
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies