Refinement in a Type Extension Context
暂无分享,去创建一个
This paper extends the methods of the refinement calculi to allow the derivation of an Oberon implementation. The use of records, pointers, opaque types and type extension distinguishes this work from previous examples. A case study for a stack abstract data type illustrates the method, which involves three data refinement steps. Firstly, a sequence of integers is refined to a sequence of integer records with pointers. Secondly, the sequence of records is refined to a linked list accessed through a start pointer. Finally, this is refined to a generic implementation that is close to Oberon code. Pointers are facilitated by declaring an explicit local data store for each stack variable. The advantage of Oberon over Modula-2 is the ability to separate the final code into two modules - a generic stack that maintains the linked List property and an integer instantiation of the stack, using type extension. This separation of concerns (isolation of the linked data structure properties) is the main benefit of the approach.