COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
P-code is used for
A
Stack-based machine
B
Accumulator based machine
C
Two operand addresses
D
None of the other options
Explanation: 

Detailed explanation-1: -Architecture. Like many other p-code machines, the UCSD p-Machine is a stack machine, which means that most instructions take their operands from a stack, and place results back on the stack. Thus, the add instruction replaces the two topmost elements of the stack with their sum.

Detailed explanation-2: -In stack machine code (sometimes called p-code), instructions will frequently have only an opcode commanding an operation, with no additional fields identifying a constant, register or memory cell, known as a zero address format. This greatly simplifies instruction decoding.

Detailed explanation-3: -A P-code machine is a type of computer that executes P-code or the assembly language of a CPU. IT professionals may refer to P-code as portable code or pseudocode.

Detailed explanation-4: -The big advantage is that you can write p-code “assembly” programs (or compile higher languages into p-code) and run them on many different machines. The language was optimized so as to be easy to emulate and to run smoothly on any machine.

There is 1 question to complete.