Java Reference
In-Depth Information
R
V
Row Shift
i [ i ]
1
Index Entry From
Row
1 L 1
2 Q2
3 U3
4 P 1
5 R2
6 W4
7 X4
8 Y5
9
10 Z5
0
2
0
3
0
4
5
5
6
Figure 5.24: Compression of the table in Figure 5.20. Only the boxed
information is actually stored in the compressed structures.
5.9.1 Error Recovery
With error recovery , we try to reset the parser so that the remaining input can
be parsed. This process may involve modifying the parse stack and remaining
input. Depending on the success of the recovery process, subsequent syntax
analysis may be accurate. Unfortunately, it is more often the case that faulty
error recovery causes errors to cascade throughout the remaining parse. For
example, consider the C fragment a=func c+d). If error recovery continues
the parse by predicting a Statement after the func, then another syntax error
is found at the parenthesis. A single syntax error has been amplified by error
recovery by issuing two error messages.
The primary measure of quality in an error-recovery process is how few
false or cascaded errors it induces. Normally, semantic analysis and code
generation are disabled upon error recovery because there is no intention to
execute the code of a syntactically faulty program.
A simple form of error recovery is often called panic mode .Inthisap-
proach, the parser skips input tokens until it finds a frequently occurring
delimiter (e.g., a semicolon). The parser then continues by expecting those
nonterminals that derive strings that can follow the delimiter.
5.9.2 Error Repair
With error repair , the parse attempts to repair the syntactically faulty program
by modifying the parsed or (more commonly) the unparsed portion of the
 
 
 
Search WWH ::




Custom Search