SYNTAX ANALYSIS
ROLE OF THE PARSER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
it is simple to implement
|
|
it never gets into an infinite loop
|
|
both(a) and both(b)
|
|
none of these
|
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.