Implementation of an Experimental System for Automatic Program Transformation Based on Generalized Partial Computation
نویسندگان
چکیده
data types of auxiliary functions. A simplification process is successful if the result entails the elimination of all recursive calls to the (user defined) source program through folding. Since the folding process comes after this process, the simplification process is nondeterministic. That is, if the folding process is unsuccessful, we backtrack our SDFU process to the simplification process that caused the folding process and undo the simplification and try another simplification if possible. Examples of simplification are shown below: 1. Let the current environment be i and a source program be a conditional expression such as if p(u) then e1 else e2. Then if p(u) is provable from i then the residual program is the result of GPC of e1 with repect to i∧ p(u). If ¬p(u) is provable from i then the residual program is the result of GPC of e2 with repect to i ∧ ¬p(u). If neither of the above cases holds within a predetermined time, then the residual program is if p(u) then (residual progam of GPC of e1 with repect to i∧p(u)) else (residual program of GPC of e2 with repect to i ∧ ¬p(u)). 2. Let mod(x, d) be a function computing the remainder of x÷d. Then mod(x∗ y, d) is replaced by mod(mod(x, d) ∗ mod(y, d), d). The purpose of this replacement is to move the mod function into the multiplication. This makes the folding of composite function with mod easier. 3. If we know the termination of function f , f(x) ≡ if p(x) then a else f(d(x)) is replaced by a, where a is a constant. 4. If f(a) = a, then f(a) is replaced by a for m > 0. Distribution Suppose that a source program e contains a conditional expression such as if p(u) then e1 else e2. Let e be Cont [if p(u) then e1 else e2]. Then the operation to produce a program if p(u) then Cont [e1] else Cont [e2] from e is called distribution. Since WSDFU deals with only strict programs, the distribution operation preserves semantics of programs. GPC of e wrt i produces a GPC tree shown in Fig. 1. In the figure, N1, N2 and N3 are new names attached to nodes. They also stand for function names defined by GPC subtrees. For example, N1(u) ≡ if p(u) then Cont [e1] else Cont [e2]. Environments of nodes N2 and N3 are i ∧ p(u) and i ∧ ¬p(u), respectively. i Cont [if p(u) then e1 else e2] N1(u) p(u) ¬p(u) N2(u) Cont [e1] Cont [e2] N3(u) Fig. 1. GPC tree for distribution of a context over a conditional expression Suppose that a source program e does not contain a conditional expression. Let e be Cont [e1] and e ′ 1 be the result of GPC of e1 wrt i. Then GPC of e wrt i 4 Yoshihiko Futamura, Zenjiro Konishi, and Robert Glück produces a GPC tree shown in Fig. 2. In the figure, the environment of node N2 is i. This process can be considered as a part of the distribution.
منابع مشابه
WSDFU: Program Transformation System Based on Generalized Partial Computation
Generalized Partial Computation (GPC) is a program transformation method utilizing partial information about input data and auxiliary functions as well as the logical structure of a source program. GPC uses both an inference engine such as a theorem prover and a classical partial evaluator to optimize programs. Therefore, GPC is more powerful than classical partial evaluators but harder to impl...
متن کاملDesign and implementation of an automatic car turning system
In this paper, a control system is designed for automatic car turning. At first, the necessary information of car turning that were collected from the traffic bylaw, car driving training centers and traffic police are explained. Then, car turning is studied experimentally on several streets with different widths. Afterward, a proper path is designed for the automatic car turning system consider...
متن کاملAn automatic test case generator for evaluating implementation of access control policies
One of the main requirements for providing software security is the enforcement of access control policies which aim to protect resources of the system against unauthorized accesses. Any error in the implementation of such policies may lead to undesirable outcomes. For testing the implementation of access control policies, it is preferred to use automated methods which are faster and more relia...
متن کاملA mathematically simple method based on denition for computing eigenvalues, generalized eigenvalues and quadratic eigenvalues of matrices
In this paper, a fundamentally new method, based on the denition, is introduced for numerical computation of eigenvalues, generalized eigenvalues and quadratic eigenvalues of matrices. Some examples are provided to show the accuracy and reliability of the proposed method. It is shown that the proposed method gives other sequences than that of existing methods but they still are convergent to th...
متن کاملAutomatic implementation of a new recovery coefficient for Reliable contour milling
In contour milling, to render the machining process more automated with significant productivity without remaining material after machining, a new recovery coefficient was developed. The coefficient was inserted in the computation of contour parallel tool paths to fix the radial depth of cut in the way to ensure an optimized overlap area between the passes in the corners, without residuals. Thu...
متن کاملAn Automatic Partial Deduction System for Constraint Logic Programs
This paper presents a new procedure of partial deduction of various constraint logic programs. The procedure takes a program-goal pair (P0, Q0) as input and outputs a resultant program-goal pair (Pn, Qn). The procedure always terminates and the computational equivalence of the program-goal pairs (P0, Q0) and (Pn, Qn) is preserved. Pn is more efficient in solving Qn than P0 in solving Q0. Our pr...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2000