Consider the grammar E → E + n | E × n | n. For the sentence n + n × n, the handles in the right-sentential forms of the reduction are:
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. n, E + n and E × n
Explanation
Bottom-up: n + n × n ⇒ reduce the first n (handle n) → E + n × n ⇒ reduce E + n → E × n ⇒ reduce E × n → E. Handles: n, E + n, E × n.More Theory of Computation and Compilers questions
- One of the purposes of using intermediate code in compilers is to:
- The sum of the minimum and maximum number of final states for a DFA having P states is equal to:
- Three-address code can be represented in special structures known as: (A) Quadruples (B) Triples (C) Patterns (D) Indirect Triples Choose t…
- Which of the statements is/are CORRECT? (A) Moore and Mealy machines are finite state machines with output capabilities. (B) Any given Moor…
- Match List I with List II according to the input to the compiler phase that processes it:List I List II (a) Syntax tree (I) Code generator…
- Arrange the following phases of a compiler in their order of execution (start to end): (a) Target code generation (b) Syntax analysis (c) C…