SlideShare a Scribd company logo
DR.B.C ROY ENGINEERING COLLEGE, DURGAPUR - 713206
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
(AFFLITIATED TO MAULANA ABUL KALAM AZAD UNIVERSITY OF TECHNOLOGY)
CONTINUOUS ASSESSMENT : 2
REPORT
ON
ERROR RECOVERY
STRATEGIES FOR DIFFERENT PARSING TECHNIQUES
SUBMITTED BY:
PRIYANKA MANNA
ROLL NO: 12000121056
PAPER CODE : PCC-CS 501
PAPER NAME : COMPILER DESIGN
AGENDA
o INTRODUCTION
o ERROR RECOVERY FOR DIFFERENT
PARSING TECHNIQUES
o CONCLUSION
o REFERENCES
INTRODUCTION:
Parsing is known as Syntax Analysis. It contains arranging the tokens as
source code into gramma cal phases that are used by the compiler to
synthesis output generally gramma cal phases of the source code are
defined by parse tree. There are various types of parsing techniques .
A parser should be able to detect and report any error in the program.
It is expected that when an error is encountered, the parser should be
able to handle it and carry on parsing the rest of the input. Mostly it is
expected from the parser to check for errors but errors may be
encountered at various stages of the compilation process. A program
may have the following kinds of errors at various stages.
 Lexical : name of some identifier typed incorrectly
 Syntactical : missing semicolon or unbalanced
parenthesis
 Semantical : incompatible value assignment
 Logical : code not reachable, infinite loop
So, error handling is important for the correct execution of code.
ERROR RECOVERY FOR DIFFERENT PARSING
TECHNIQUES:
There are mainly five error recovery strategies, which are as follows
 Panic mode
 Phrase level recovery
 Error production
 Global correction
 Symbol table
ERROR RECOVERY IN PREDICTIVE PARSING:
o PANIC-MODE :
Panic-mode error recovery says that all the input symbols
are skipped until a synchronizing token is found from the
string.
In this recovery method, we use FOLLOW symbols as
synchronizing tokens and the “synch” in the predictive
parsing table to indicate synchronizing tokens obtained
from the nonterminal’s FOLLOW sets.
The terminal symbols which lie in follow set of non-
terminal they can be used as a synchronizing token set for
that of non-terminal. In simple panic-mode error recovery
for the LL(1)parsing.
Selection of synchronizing set:
There are two ways of selecting synchronizing set:
1. Place all symbols in FOLLOW(A) into the synchronizing
set for nonterminal A. We can continue parsing until we
skip tokens of an element of FOLLOW(A) is seen and pop
it from the stack specifically.
We might add keywords that begin statements to the
synchronizing sets for the non-terminals generating
expressions.
2. If a nonterminal can generate the empty string, then
the production deriving ε can be used as a default. This
may produce some delay in error detection, but errors
cannot be missed. This approach reduces the number of
non-terminals that have to be considered during error
recovery.
PHRASE-LEVEL RECOVERY:
Phrase level recovery is implemented by filling in the
blank entries in the predictive parsing table with pointers
to error routines. At each unfilled entry in the parsing
table, it is filled by a pointer to a special error routine that
will take care of that error case specifically. These error
routines can be of different types like :
 change, insert, or delete input symbols.
 issue appropriate error messages.
 pop items from the stack.
ERROR RECOVERY IN LR PARSING:
LR Parser Basically Uses the Mentioned Two Techniques to
Detect Errors:
1. Syntactic Phase recovery
2. Panic mode recovery
o SYNTACTIC PHASE RECOVERY:
Syntactic Phase Recovery Follows the Given Steps:
1.Programmer mistakes that call error procedures in the
parser table are determined based on the language.
2.Creating error procedures that can alter the top of the
stack and/or certain symbols on input in a way that is
acceptable for table error entries.
o PANIC-MODE :
This approach involves removing consecutive characters
from the input one by one until a set of synchronized
tokens is obtained. Delimiters such as or are synchronizing
tokens. The benefit is that it is simple to implement and
ensures that you do not end up in an infinite loop. The
drawback is that a significant quantity of data is skipped
without being checked for additional problems.
Panic mode recovery follows the given steps:
1. Scan the stack until you find a state ‘a’ with a goto() on a
certain non-terminal ‘B’ (by removing states from the
stack).
2. Until a symbol ‘b’ that can follow ‘B’ is identified, zero or
more input symbols are rejected.
ERROR RECOVERY IN OPERATOR PRECEDENCE
PARSING:
o PANIC MODE RECOVERY:
When a syntax error is detected, the parser enters a panic
mode by discarding input tokens until it finds a
synchronization point. In operator precedence parsing,
synchronization points are often tokens with lower
precedence or tokens that signal the end of an expression
(e.g., a semicolon).
Implementation:
Identify tokens that can serve as synchronization points for
your grammar and error recovery. When an error is
encountered, skip tokens until a synchronization point is found
and resume parsing from there.
o Phrase-Level Recovery:
Instead of skipping tokens, the parser can attempt to insert
or replace tokens to match the expected grammar
production. For example, if an operator is missing, the
parser can insert it or suggest it as an error correction.
Implementation:
Analyze the grammar rules and operator precedence levels
to determine which tokens or constructs are likely to be
missing or incorrect. When an error is detected, insert or
replace tokens accordingly and continue parsing.
CONCLUSION:
Error recovery strategies play a vital role in parsing techniques used
in programming language processing and compila on. These
strategies help parsers gracefully handle syntax errors in source code
and provide meaningful feedback to developers. The choice of error
recovery strategy depends on the parsing technique being used and
the language's specific requirements. Some common strategies
include panic mode, phrase-level recovery, backtracking, custom
error messages, and seman c ac ons.
Effec ve error recovery not only ensures that parsers can con nue
processing input despite errors but also aids in improving the overall
developer experience by providing clear and ac onable error
messages. Regardless of the parsing technique employed, a well-
designed error recovery mechanism contributes to more robust
compilers and interpreters, helping developers iden fy and correct
issues in their code efficiently.
REFERENCES:
 h ps://www.geeksforgeeks.org/error-recovery-in-predic ve-
parsing/
 h ps://www.geeksforgeeks.org/error-recovery-in-lr-parsing/
 h ps://www.tutorialspoint.com/compiler_design/compiler
design_error_recovery.html
 h ps://gtu-paper-solu on.com/Paper-Solu on/CompilerDesign-
2170701/Winter-2018/Ques on-2-b
 h ps://edurev.in/t/248392/Error-detec on-Recovery-in-Compiler

More Related Content

Similar to 12000121056_Priyankamanna-3.pdf

role of lexical anaysis
role of lexical anaysisrole of lexical anaysis
role of lexical anaysis
Sudhaa Ravi
 
System software module 4 presentation file
System software module 4 presentation fileSystem software module 4 presentation file
System software module 4 presentation file
jithujithin657
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & Recovery
Akhil Kaushik
 
Compiler design important questions
Compiler design   important questionsCompiler design   important questions
Compiler design important questions
akila viji
 
match the following attributes to the parts of a compilerstrips ou.pdf
match the following attributes to the parts of a compilerstrips ou.pdfmatch the following attributes to the parts of a compilerstrips ou.pdf
match the following attributes to the parts of a compilerstrips ou.pdf
arpitaeron555
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithm
mshoaib15
 
Phases of Compiler.pdf
Phases of Compiler.pdfPhases of Compiler.pdf
Phases of Compiler.pdf
SuchandaBanerjee6
 
Code generation errors and recovery
Code generation errors and recoveryCode generation errors and recovery
Code generation errors and recovery
Momina Idrees
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
Ashwini Sonawane
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
SuchandaBanerjee6
 
Assignment1
Assignment1Assignment1
Assignment1
Sunita Milind Dol
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
Radhika Talaviya
 
CS 280 Fall 2022 Programming Assignment 2 November.docx
CS 280 Fall 2022 Programming Assignment 2 November.docxCS 280 Fall 2022 Programming Assignment 2 November.docx
CS 280 Fall 2022 Programming Assignment 2 November.docx
richardnorman90310
 
Assignment4
Assignment4Assignment4
Assignment4
Sunita Milind Dol
 
Error detection recovery
Error detection recoveryError detection recovery
Error detection recoveryTech_MX
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowcharthermiraguilar
 
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGESOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
IJCI JOURNAL
 
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGESOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
IJCI JOURNAL
 
Compiler Design(Nanthu)
Compiler Design(Nanthu)Compiler Design(Nanthu)
Compiler Design(Nanthu)
guest91cc85
 

Similar to 12000121056_Priyankamanna-3.pdf (20)

role of lexical anaysis
role of lexical anaysisrole of lexical anaysis
role of lexical anaysis
 
System software module 4 presentation file
System software module 4 presentation fileSystem software module 4 presentation file
System software module 4 presentation file
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & Recovery
 
Compiler design important questions
Compiler design   important questionsCompiler design   important questions
Compiler design important questions
 
match the following attributes to the parts of a compilerstrips ou.pdf
match the following attributes to the parts of a compilerstrips ou.pdfmatch the following attributes to the parts of a compilerstrips ou.pdf
match the following attributes to the parts of a compilerstrips ou.pdf
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithm
 
Phases of Compiler.pdf
Phases of Compiler.pdfPhases of Compiler.pdf
Phases of Compiler.pdf
 
Code generation errors and recovery
Code generation errors and recoveryCode generation errors and recovery
Code generation errors and recovery
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 
Assignment1
Assignment1Assignment1
Assignment1
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
 
CS 280 Fall 2022 Programming Assignment 2 November.docx
CS 280 Fall 2022 Programming Assignment 2 November.docxCS 280 Fall 2022 Programming Assignment 2 November.docx
CS 280 Fall 2022 Programming Assignment 2 November.docx
 
Assignment4
Assignment4Assignment4
Assignment4
 
Error detection recovery
Error detection recoveryError detection recovery
Error detection recovery
 
Programming process and flowchart
Programming process and flowchartProgramming process and flowchart
Programming process and flowchart
 
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGESOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
 
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGESOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
 
Compiler Design(Nanthu)
Compiler Design(Nanthu)Compiler Design(Nanthu)
Compiler Design(Nanthu)
 

Recently uploaded

Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
dxobcob
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
AIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdfAIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdf
RicletoEspinosa1
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 

Recently uploaded (20)

Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
AIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdfAIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdf
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 

12000121056_Priyankamanna-3.pdf

  • 1. DR.B.C ROY ENGINEERING COLLEGE, DURGAPUR - 713206 DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING (AFFLITIATED TO MAULANA ABUL KALAM AZAD UNIVERSITY OF TECHNOLOGY) CONTINUOUS ASSESSMENT : 2 REPORT ON ERROR RECOVERY STRATEGIES FOR DIFFERENT PARSING TECHNIQUES SUBMITTED BY: PRIYANKA MANNA ROLL NO: 12000121056 PAPER CODE : PCC-CS 501 PAPER NAME : COMPILER DESIGN
  • 2. AGENDA o INTRODUCTION o ERROR RECOVERY FOR DIFFERENT PARSING TECHNIQUES o CONCLUSION o REFERENCES
  • 3. INTRODUCTION: Parsing is known as Syntax Analysis. It contains arranging the tokens as source code into gramma cal phases that are used by the compiler to synthesis output generally gramma cal phases of the source code are defined by parse tree. There are various types of parsing techniques . A parser should be able to detect and report any error in the program. It is expected that when an error is encountered, the parser should be able to handle it and carry on parsing the rest of the input. Mostly it is expected from the parser to check for errors but errors may be encountered at various stages of the compilation process. A program may have the following kinds of errors at various stages.  Lexical : name of some identifier typed incorrectly  Syntactical : missing semicolon or unbalanced parenthesis  Semantical : incompatible value assignment  Logical : code not reachable, infinite loop So, error handling is important for the correct execution of code.
  • 4. ERROR RECOVERY FOR DIFFERENT PARSING TECHNIQUES: There are mainly five error recovery strategies, which are as follows  Panic mode  Phrase level recovery  Error production  Global correction  Symbol table ERROR RECOVERY IN PREDICTIVE PARSING: o PANIC-MODE : Panic-mode error recovery says that all the input symbols are skipped until a synchronizing token is found from the string. In this recovery method, we use FOLLOW symbols as synchronizing tokens and the “synch” in the predictive parsing table to indicate synchronizing tokens obtained from the nonterminal’s FOLLOW sets. The terminal symbols which lie in follow set of non- terminal they can be used as a synchronizing token set for that of non-terminal. In simple panic-mode error recovery for the LL(1)parsing.
  • 5. Selection of synchronizing set: There are two ways of selecting synchronizing set: 1. Place all symbols in FOLLOW(A) into the synchronizing set for nonterminal A. We can continue parsing until we skip tokens of an element of FOLLOW(A) is seen and pop it from the stack specifically. We might add keywords that begin statements to the synchronizing sets for the non-terminals generating expressions. 2. If a nonterminal can generate the empty string, then the production deriving ε can be used as a default. This may produce some delay in error detection, but errors cannot be missed. This approach reduces the number of non-terminals that have to be considered during error recovery. PHRASE-LEVEL RECOVERY: Phrase level recovery is implemented by filling in the blank entries in the predictive parsing table with pointers to error routines. At each unfilled entry in the parsing table, it is filled by a pointer to a special error routine that will take care of that error case specifically. These error routines can be of different types like :  change, insert, or delete input symbols.  issue appropriate error messages.  pop items from the stack. ERROR RECOVERY IN LR PARSING: LR Parser Basically Uses the Mentioned Two Techniques to Detect Errors: 1. Syntactic Phase recovery 2. Panic mode recovery
  • 6. o SYNTACTIC PHASE RECOVERY: Syntactic Phase Recovery Follows the Given Steps: 1.Programmer mistakes that call error procedures in the parser table are determined based on the language. 2.Creating error procedures that can alter the top of the stack and/or certain symbols on input in a way that is acceptable for table error entries. o PANIC-MODE : This approach involves removing consecutive characters from the input one by one until a set of synchronized tokens is obtained. Delimiters such as or are synchronizing tokens. The benefit is that it is simple to implement and ensures that you do not end up in an infinite loop. The drawback is that a significant quantity of data is skipped without being checked for additional problems. Panic mode recovery follows the given steps: 1. Scan the stack until you find a state ‘a’ with a goto() on a certain non-terminal ‘B’ (by removing states from the stack). 2. Until a symbol ‘b’ that can follow ‘B’ is identified, zero or more input symbols are rejected. ERROR RECOVERY IN OPERATOR PRECEDENCE PARSING: o PANIC MODE RECOVERY: When a syntax error is detected, the parser enters a panic mode by discarding input tokens until it finds a synchronization point. In operator precedence parsing, synchronization points are often tokens with lower precedence or tokens that signal the end of an expression (e.g., a semicolon).
  • 7. Implementation: Identify tokens that can serve as synchronization points for your grammar and error recovery. When an error is encountered, skip tokens until a synchronization point is found and resume parsing from there. o Phrase-Level Recovery: Instead of skipping tokens, the parser can attempt to insert or replace tokens to match the expected grammar production. For example, if an operator is missing, the parser can insert it or suggest it as an error correction. Implementation: Analyze the grammar rules and operator precedence levels to determine which tokens or constructs are likely to be missing or incorrect. When an error is detected, insert or replace tokens accordingly and continue parsing.
  • 8. CONCLUSION: Error recovery strategies play a vital role in parsing techniques used in programming language processing and compila on. These strategies help parsers gracefully handle syntax errors in source code and provide meaningful feedback to developers. The choice of error recovery strategy depends on the parsing technique being used and the language's specific requirements. Some common strategies include panic mode, phrase-level recovery, backtracking, custom error messages, and seman c ac ons. Effec ve error recovery not only ensures that parsers can con nue processing input despite errors but also aids in improving the overall developer experience by providing clear and ac onable error messages. Regardless of the parsing technique employed, a well- designed error recovery mechanism contributes to more robust compilers and interpreters, helping developers iden fy and correct issues in their code efficiently.
  • 9. REFERENCES:  h ps://www.geeksforgeeks.org/error-recovery-in-predic ve- parsing/  h ps://www.geeksforgeeks.org/error-recovery-in-lr-parsing/  h ps://www.tutorialspoint.com/compiler_design/compiler design_error_recovery.html  h ps://gtu-paper-solu on.com/Paper-Solu on/CompilerDesign- 2170701/Winter-2018/Ques on-2-b  h ps://edurev.in/t/248392/Error-detec on-Recovery-in-Compiler