A Formal Translation From an Imperative Language With Array to a Declarative Language

The goal of this paper is to present a translation function of programs written in an imperative language with array to programs written in a declarative language. The two languages used, L1 and L2, are extensions of the languages introduced by [1] which supported expressions needed by a programming language such as assignment, loops and conditional branching. To those, were added expressions related to array creation (x = allocate(y)), manipulation (x[1] = 9) and destruction (free(x)). The original translation function also needed some modifications to migrate program with array definitions from L1 to L2. Indeed, the original translation function could not handle a single variable having multiple definitions at different offsets (indexes).