Formal specifications and supporting tools have shown to be very effective to improve the quality and correctness of a software system. A compiler is large and complex software; it takes as input a program written in some language and generates as output a program in another language. One of the main characteristics of any compiler is to preserve the semantics of the program being compiled. Therefore, developing correct compilers that can generate faithful target code without introducing any errors is critically important. In this paper, we show how to use Z notation to formally specify part of the Pit, which is a general-purpose programming language that we are currently developing. The main idea behind Pit is to create a language where the programmer can choose between allocating memory manually by using static ally-typed "primitive" variables or allowing the compiler to insert memory management code automatically by using dynamically-typed "auto" variables. This feature, in turn, allows a programmer to choose between automatically ensuring that there are no buffer overrun or integer overflow vulnerabilities in the code.
[1]
J. Michael Spivey,et al.
The Z notation - a reference manual
,
1992,
Prentice Hall International Series in Computer Science.
[2]
Jason Hickey,et al.
Building Reliable Compilers with a Formal Methods Framework
,
2003
.
[3]
Arnd Poetzsch-Heffter,et al.
Specification and verification of object-oriented programs
,
1997
.
[4]
Viljem Zumer,et al.
A reusable object-oriented approach to formal specifications of programming languages
,
1998
.
[5]
Jonathan Jacky,et al.
The Way of Z: Practical Programming with Formal Methods
,
1996
.
[6]
Edmund M. Clarke,et al.
Formal Methods: State of the Art and Future Directions Working Group Members
,
1996
.
[7]
Ben L. Divito.
Formal methods demonstration project for space applications
,
1995
.
[8]
Jeannette M. Wing.
A specifier's introduction to formal methods
,
1990,
Computer.
[9]
Jin Song Dong,et al.
An object-oriented approach to the semantics of programming languages
,
1994
.