Compiler Design

105601
Back to Compiler Design

Module 3: Semantic Analysis, Symbol Table, Run-time environment

  1. Q1c. A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar: S \to xxW {print "1"}, S \to y {print "2"}, S \to Sz {print "3"} What is the translation of xxxxyzz using the syntax directed translation scheme described by the above rules? (i) 23131 (ii) 11233 (iii) 11231 (iv) 3321120232m

    Module 3: Semantic Analysis, Symbol Table, Run-time environment

    A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar:
    SxxWS \to xxW {print "1"}, SyS \to y {print "2"}, SSzS \to Sz {print "3"}
    What is the translation of xxxxyzzxxxxyzz using the syntax directed translation scheme described by the above rules?
    (i) 23131
    (ii) 11233
    (iii) 11231
    (iv) 33211

    View this question on its own page →
  2. Q1h. Synthesized attributed are calculated (i) From the values of attributes of the children of the node (ii) From the values of attributes of the parent of the node (iii) From the values of attributes of the siblings of the node (iv) None of these20232m

    Module 3: Semantic Analysis, Symbol Table, Run-time environment

    Synthesized attributed are calculated
    (i) From the values of attributes of the children of the node
    (ii) From the values of attributes of the parent of the node
    (iii) From the values of attributes of the siblings of the node
    (iv) None of these

    View this question on its own page →
  3. Q2b. What is an activation record? Explain how they are used to access various local and global variables.20237m

    Module 3: Semantic Analysis, Symbol Table, Run-time environment

    What is an activation record? Explain how they are used to access various local and global variables.

    View this question on its own page →
  4. Q4a. Given the Syntax-Directed Definition below with the synthesized attribute val. Draw the annotated parse tree for the expression (3+4) * (5+6) L \to E, L.val = E.val E \to T, E.val = T.val E \to E_1 + T, E.val = E_1.val + T.val T \to F, T.val = F.val T \to T_1 * F, T.val = T_1.val * F.val F \to (E), F.val = E.val F \to digit, F.val = digit.lexval20237m

    Module 3: Semantic Analysis, Symbol Table, Run-time environment

    Given the Syntax-Directed Definition below with the synthesized attribute val. Draw the annotated parse tree for the expression (3+4)(5+6)(3+4) * (5+6)

    LEL \to E, L.val=E.valL.val = E.val
    ETE \to T, E.val=T.valE.val = T.val
    EE1+TE \to E_1 + T, E.val=E1.val+T.valE.val = E_1.val + T.val
    TFT \to F, T.val=F.valT.val = F.val
    TT1FT \to T_1 * F, T.val=T1.valF.valT.val = T_1.val * F.val
    F(E)F \to (E), F.val=E.valF.val = E.val
    FdigitF \to digit, F.val=digit.lexvalF.val = digit.lexval

    View this question on its own page →
  5. Q5b. Explain how type checking and error reporting are performed in compiler. Draw syntax tree and DAG for the statement: a = (a * b + c) \uparrow (b + c) * b + c20237m

    Module 3: Semantic Analysis, Symbol Table, Run-time environment

    Explain how type checking and error reporting are performed in compiler. Draw syntax tree and DAG for the statement:
    a=(ab+c)(b+c)b+ca = (a * b + c) \uparrow (b + c) * b + c

    View this question on its own page →
  6. Q7a. Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.20237m

    Module 3: Semantic Analysis, Symbol Table, Run-time environment

    Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.

    View this question on its own page →