Professional Documents
Culture Documents
STUDENT ID - 201001102018
BATCH - BCA1
STREAM - BCA(H)
SEMESTER NO. - 2
ASSIGNMENT NO. -2
1)Explain nested macro call with short example.
ANS:
Nested Macro Call :
MACRO
CAL &P
MOVE , AREGR, &P, ADD, ‘I’ (Set of instruction of macro)
MEND
MACRO X Y Z (Argument X,Y,Z passed through &P1,&P2,&P3)
CAL 1 &P1,P2,P3
CAL &P 1 CAL X
MOVE , AREGR X, ADD X, ‘I’
CAL &P 2 CAL Y
MOVE , AREGR Y, ADD Y, ‘I’
CAL & P3 CAL Z
MOVE , AREGR Z, ADD Z, ‘I’
CAL 1 X,Y,Z
MEND
Example :
A macro may be used in the definition of another macro as illustrated
below.
#include<stdio.h>
#define Area(x) x*x
#define Costpaint(x,y,z) (z*y + Area (x))
void main()
{
int A = 8, B= 6, C = 4;
clrscr();
printf("The area of square= %d\n", Area(A));
printf("Cost of paint= %d\n", Costpaint(A,B,C));
}
ANS:
LEX
Lex is a computer program that generates lexical analyzers. Mike Lex and
Eric Schmidt are the original developers of Lex. It is a standard lexical
analyzer generator on various UNIX systems. Lex is specified as a part of
the POSIX standard. Generally, Lex is used with the Yacc parser generator.
Furthermore, Lex reads an input stream specifying the lexical analyzer.
Then, it outputs the source code implementing the lexer in the C language.
YACC
ANS:
Scanning: Turning source code into a token stream. This stage removes
white space and comments, and identifies what kind of token each piece
of the code is.
Parsing: Turning a token stream into a parse tree. This stage checks that
the sequence of tokens is grammatically correct and can be grouped
together according to the specifications of how the language works.
ANS:
Macro Subroutine
Macro can be called only after its This is not true for Subroutine.
definition.
ANS:
ANS:
ANS:
LTORG
The LTORG directive, which stands for 'origin for literals', allows a
programmer to specify where literals should be placed. If a program does
not use an LTORG statement, the assembler would enter all literals used in
the program into a single pool and allocate memory to them when it
encounters the END statement.
They can also serve as barcode readers, and they are used in large stores,
warehouses, hospitals, or information in the field, to access a database
from a remote location. Others have a touch screen, IrDA, Bluetooth, a
memory card slot, or one or more data capture devices. PDT's frequently
run wireless device management software that allows them to interact
with a database or software application hosted on a server or mainframe
computer.
A Typical PDT
Scans the entire source file only Require two passes to scan the source
once. file.