0
0
Compiler Designknowledge~10 mins

Instruction selection in Compiler Design - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to identify the phase where instruction selection occurs in a compiler.

Compiler Design
instruction_selection_phase = "[1]"
Drag options to blanks, or click blank then click option'
ALexical Analysis
BSemantic Analysis
CParsing
DCode Generation
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing instruction selection with parsing or lexical analysis.
Thinking instruction selection happens during semantic analysis.
2fill in blank
medium

Complete the code to describe the input to the instruction selection process.

Compiler Design
input_to_instruction_selection = "[1]"
Drag options to blanks, or click blank then click option'
AMachine code
BIntermediate representation
CSource code
DAssembly code
Attempts:
3 left
💡 Hint
Common Mistakes
Assuming instruction selection works directly on source code.
Confusing assembly code as input instead of output.
3fill in blank
hard

Fix the error in the statement about instruction selection.

Compiler Design
instruction_selection = "It converts [1] code directly into source code."
Drag options to blanks, or click blank then click option'
Aintermediate
Bsource
Cassembly
Dmachine
Attempts:
3 left
💡 Hint
Common Mistakes
Thinking instruction selection converts machine code to source code.
Confusing source code as input or output.
4fill in blank
hard

Fill both blanks to complete the description of instruction selection.

Compiler Design
Instruction selection maps [1] to [2] instructions.
Drag options to blanks, or click blank then click option'
Aintermediate code
Bsource code
Cmachine
Dhigh-level
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing source code with intermediate code.
Confusing machine instructions with source code.
5fill in blank
hard

Fill both blanks to complete the dictionary comprehension that filters instructions by cost and type.

Compiler Design
selected_instructions = {instr:cost for instr, cost in instructions.items() if cost [1] 10 and instr [2] 'arithmetic'}
Drag options to blanks, or click blank then click option'
A:
B<
C==
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '==' for comparison.
Using ',' instead of ':' in dictionary comprehension.
Using wrong comparison operators.