A
system is provided for preparing multiple
recovery devices in accordance with the types of tokens in data strings, such as in programs or in documents, and the types of
syntax rule errors, and for selectively employing
recovery devices to correct errors. A structure
recovery system comprises: a parser 20 for analyzing the structure of a data string written in accordance with a predetermined rule and for detecting an error in accordance with the predetermined rule; and a recovery device, independent of the parser 20, for, upon the
receipt of a request from the parser 20, correcting in accordance with the predetermined rule the error detected in the data string by the parser 20, wherein the recovery device includes a set of
syntax recovery units 22 that individually employ simple functions for correcting specific types of errors, and wherein the recovery device selectively employs the
syntax recovery units 22 in accordance with the error type according to the predetermined rule, in order to correct a variety of errors in a data string.