Construction of SLR(1) Parser with Error Diagnosis and Recovery Mechanism
Haili Luo · 2013
SLR(1) parser is a kind of important formal syntax parser. Error diagnosis and recovery mechanism is very important to SLR(1) parser. Without error diagnosis and recovery mechanism, SLR(1) parser will be paralyzed when syntax errors are confronted. With error diagnosis and recovery mechanism, syntax errors can be promptly reported and SLR(1) parser can recover from errors as soon as possible when syntax errors are confronted. In this article, two of kinds of methods of constructing error diagnosis and recovery mechanism were introduced and the syntax parsing process of SLR(1) parser with each kind of error diagnosis and recovery mechanism was analyzed by an example. The two of kinds of methods of constructing error diagnosis and recovery mechanism are not only applied to SLR(1) parser but also applied to other LR parser.