|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Correction
is a discrete instruction for a
Parser
to execute (apply) during an error recovery.
Field Summary | |
static int |
ABORT
The "Abort" correction instruction causes the Parser to immediately bail by throwing a
TranslationException . |
static int |
NOOP
The "No Operation" correction instruction. |
static int |
TUMBLE
The "Tumble" correction instruction. |
static int |
WAIT
The "Wait" correction instruction. |
Method Summary | |
int |
getType()
Returns the type of this Correction as one of the
constants in this interface. |
Object |
getValue()
Returns some value associated with this Correction. |
Field Detail |
public static final int NOOP
public static final int WAIT
WAIT
is closely tied to the notion of
"synchonizing tokens"; when the Parser sees a WAIT
instruction, it calls Correction.getValue()
and
expects an Integer
. The value of this
Integer
should correspond to a terminal
Symbol
. The Parser
will then discard
incoming terminals from the LexerInterpreter
until
it sees one that whose type matches the given
Integer
. When that happens, the
Parser
will advance to the next
Correction
in the scheduled
Recovery
.
For example, if the symbol type for a semicolon in some grammar
is 12, then WAIT 12
means discard all input
until you see a semicolon; when you do, go ahead to the next
correction in the recovery plan. In this hypothetical
grammar then, the semicolon is a synchronizing token.public static final int TUMBLE
DPA.action()
method with the current input token
and the current state on the top of the state stack until it
returns a non-error Action
from the
DPA
. After each unsuccessful challenge, the state
stack is popped. This has the effect of backing up through the state graph until one can move forward again. It is called "tumble" because it hybridizes the is loose notion of finding the right configuration in a lock (finding the right input), and the notion of falling (the depth of the stack).
The "Wait and Tumble" is a useful recovery plan.
public static final int ABORT
Parser
to immediately bail by throwing a
TranslationException
.Method Detail |
public int getType()
Correction
as one of the
constants in this interface.public Object getValue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |