in Compiler Design edited by
873 views
5 votes

Write short answers to the following:

  1. Which of the following macros can put a macro assembler into an infinite loop?
.MACRO MI,X
.IF EQ,X
M1 X+1
.ENDC
.IF NE,X
.WORD X
.ENDC
.ENDM
.MACRO M2,X
.IF EQ,X
M2 X
.ENDC
.IF NE,X
.WORD X+1
.ENDC
.ENDM 

Give an example call that does so.

in Compiler Design edited by
873 views

1 comment

plz solve this
0

Subscribe to GO Classes for GATE CSE 2022

1 Answer

7 votes
 
Best answer
Macro $M_2$ can put the macro assembler into an infinite loop when called with $M_2(0)$

$(EQ(X)$ is TRUE when $X = 0)$

For $M_1$ the argument $X$ is incremented for the recursive call and so the macro expansion will happen maximum $2$ times.
by

1 comment

Source for this???
0

Related questions