COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Advantage of panic mode of error recovery is that
A
it is simple to implement
B
it never gets into an infinite loop
C
both(a) and both(b)
D
none of these
Explanation: 

Detailed explanation-1: -Panic mode When a parser encounters an error anywhere in the statement, it ignores the rest of the statement by not processing input from erroneous input to delimiter, such as semi-colon. This is the easiest way of error-recovery and also, it prevents the parser from developing infinite loops.

Detailed explanation-2: -Panic-mode recovery. • In panic-mode recovery, on discovering an error, the parser discards input symbols one at a time until one of a designated set of synchronizing tokens is found. • The synchronizing tokens are usually delimiters, such as a semicolon, whose role in the source program is clear.

Detailed explanation-3: -Different Error recovery methods in Compiler Design are: Panic mode recovery. Statement mode recovery. Error productions.

Detailed explanation-4: -Error Recovery in Lexical Analyzer In the panic mode, the successive characters are always ignored until we reach a well-formed token. By inserting the missing character into the remaining input. Replace a character with another character. Transpose two serial characters.

There is 1 question to complete.