Functional Programming Framework For Generating Random Java Programs With Prolog-Based Grammar Validation

Giovanni Agugini Bassi
Compilers and pRogram Analysis and Testing tool (RAT) are software programs whose correctness affects in a significant way the quality and the performance of the software implemented in any production sector. Compilers are primarily essential for code design and implementation in terms of run time performance, reliability and even security of an application. Thus, testing compilers and RAT tools for discovering vulnerabilities and anomalies is in the best interest for any organization whose
more » ... ware is a core asset. Software and academic organizations have approached with different methodologies the problem of testing compilers. Formal methods are good for expressing constraints but do not a priori guarantee correctness. Moreover, it is difficult to formalize a model and avoid ambiguity when using formal methods. Another possible approach is automated testing, which refers to the process of generating random programs as benchmarks. In this work, we propose ProGen, a functional programming framework for generating random Java programs. ProGen aims at combining both previously mentioned methods; a Prolog formal specification of the Java Language Specification validates the work of an automated program generator. The result from the application of this framework are syntactically correct programs in a subset of Java. We have used Scala as our functional programming language for allowing greater testability of the application. Finally, we let the user specify parameters related to the generation properties, for example, the number of classes and the primitive types, to let the application be highly customizable and configurable.
doi:10.25417/uic.12480920.v1 fatcat:p273vybyovgifevnbjzyjzfmyu