The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+4 votes
353 views

Write short answers to the following:

(i). 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 by Veteran (52.1k points) | 353 views
0
plz solve this

1 Answer

0 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 Veteran (416k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,845 questions
54,783 answers
189,422 comments
80,415 users