Unit 2 Macro Processors and compilers Flashcards

1
Q

What is a macro?

A

Unit of specification for program generation through expansion.

It defines new operation or a new method of declaring data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Macro expansion:

A

Macro name with parameters is replaced by some code generated from its body.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Macro Processor tasks:

A
  1. Recognise macro definitions
  2. Save it.
  3. Recognise macro calls
  4. expand macro calls
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Compare MAcro with

A

functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Types of Macro Expansion:

A
  1. Lexical 2. Semantic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Lexical Expansion

A
  • Replace formal args by actual args.
  • Replace a char string by another char string.

Generate assembly statement from model statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Semantic Satiation:

A

Generation of instructions tailored to requirements of a specific usage.
It makes it more adaptive.
Conditional stuff.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Macro Definition:

A

it consists of name of macro, params (optional), body.

Definition enclosed btw macro and mend.

macro
name
\:
body instructions
\:
mend
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

formal paramter specification:

A

&[] refer ppt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

types of param :

A
  • Positional (Default)
  • Keyword
  • default specification of param
  • Macro with mixed param lists.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Macro call:

A

[[,..]]
refer ppt
macro name, appears in the mnemonic opcode field of the assembly statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

check chapter 3 in tht book

A

for similarities in actual param specification and operand specification.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

+

A

it’s apparently used to differentiate btw original statements and macro statements.

pata naheee

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Expansion time control flow:

A
  • If no preprocessor statements then its sequentially.

- Macro Exansion Counter (MEC) helps in implementation of flow control.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

strings that Model statement has:

A
  1. Ordinary string that stand for itself.
  2. name formal params preceded by &.
  3. name of preprocessor variable preceeded by &.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Positional Param :

A

written as &

formal param take value of actual param at same position.

17
Q

Keyword param:

A

for this, when calling macro, actual pram spec is written as =
refer ppt < . >

look at macro definition for them as well
&name=

18
Q

Default specifications with paramenters:

A

assign a default value in the macro definition, usually at last.
so if when calling, no value assigned to this arg then default val is automatically assigned

19
Q

more about args.. order?

A

Positional before keyword