Patent ID: 6886115

Claim:
A structure recovery system comprising: analysis means for analyzing the structure of a data string written in accordance with a predetermined rule, said rule comprising: a) generating a grammar information object; b) emptying buffers to receive a data string; c) causing a context pointer to indicate a root node of an abstract syntax tree; d) obtaining a set of syntax recovery units; e) inputting a data string comprising a stream of tokens to the buffers; f) extracting a token from the buffer as a target token; and when the target token is the end of the data string generating and outputting an abstract data tree, and for detecting an error in accordance with said predetermined rule by a method further comprising receiving a non-terminal token, determining from the grammar information object if the token matches a context pointer, and if so adding the token to the context pointer by the steps of: a) adding a node to which the terminal token is appended to the context pointer; b) shifting the point indicated by the by the context pointer to the newly added node to which the non-terminal token is appended; c) repeating steps a) and b) for all child nodes; d) shifting the context pointer to the parent node; and e) obtaining a next token if the node does not contain all child nodes or if the context pointer points back to a parent node; and recovery means for, upon the receipt of a request from said analysis means, correcting in accordance with said predetermined rule said error detected in said data string by said analysis means, wherein said recovery means includes a set of syntax recovery units that individually employ simple functions for correcting specific types of errors, and wherein said recovery means selectively employs said syntax recovery means based on the error type in accordance with said predetermined rule in order to correct a variety of errors in said data string by a method further comprising sequentially using syntax recovery units where a syntax recovery unit receives an error message if a token does not grammatically match the syntax pointer, and the syntax recovery unit sequentially passing the error to a subsequent syntax recovery unit until a syntax recovery unit matching the error type is found, said syntax recovery unit a) resetting the current abstract syntax tree, buffer, and context pointer; b) recovering a pointer where in accordance with said syntax rules no error exists; and c) notifying the parser that the correction was successfully applied.