1. A translation device that translates an untranslated program described in a first programming language into a translated program described in a second programming language, comprising: a declaration translation unit that translates a declaration that a storage area for retaining a first untranslated variable and a storage area for retaining a second untranslated variable overlap in the untranslated program into a declaration that a first translated variable and a first translated flag corresponding to the first untranslated variable and a second translated variable, and a second translated flag corresponding to the second untranslated variable are retained in storage areas that do not mutually overlapin the translated program; an assignment translation unit that translates text that assigns a value to the first untranslated variable in the untranslated program into text that assigns the value to the first translated variable, writes information to be recorded in an overlapping storage area among the assigned value in a storage area corresponding to the overlapping storage area among the storage area for retaining the second translated variable, and writes in the second translated flag, whether or not the information recorded in the storage area for retaining the second translated variable is valid as a value of the second translated variable in the translated program, and translates text that assigns a value to the second untranslated variable in the untranslated program into text that assigns the value into the second translated variable, writes information to be recorded in the overlapping storage area among the assigned value in the storage area corresponding to the overlapping storage area among the storage area for retaining the first translated variable, and writes in the first translated flag, whether or not the information recorded in the storage area for retaining the first translated variable is valid as a value of the first translated variable in the translated program; and a reference translation unit that translates an equation that refers to a value of the first untranslated variable in the untranslated program into an equation that determines whether or not the information recorded in the storage area for retaining the first translated variable is valid as a value of the first translated variable by referring to the first translated flag, and referring to the value of the first translated variable when determined as valid, and creating an exception when determined as invalid in the translated program, and translates an equation that refers to a value of the second untranslated variable in the untranslated program into an equation that determines whether or not the information recorded in the storage area for retaining the second translated variable is valid as a value of the second translated variable by referring to the second translated flag, and referring to the value of the second translated variable when determined as valid, and creating an exception when determined as invalid in the translated program.