关键词:
Java programming language
摘要:
We have introduced a formal model (high-level operational machine) of asequential Java-like program in the style of abstract state machines. An algebraic model of anobject class of an object-oriented programming language has been elaborated with this aim. As aresult, the denotational semantics of the basic class components (fields, constructors, and methods)has been defined for the subsequent use for interpreting expressions and statements. This is thedenotational part of the approach suggested. The transition of our machine from one state to anotheris the operational part of the approach. The use of the formal operational machine made it possibleto get a high level of abstraction, which cannot be obtained in a pure operational approach, andsimplicity of mapping, which cannot be obtained in a pure denotational approach based on the use ofsome universal mathematical structures as denotations. Each object in our machine possesses a stateand a unique identity. An object identity is represented by a reference that is an element of aspecial reference sort. The state is represented by a number of instance variables, whose values canbe updated. These variables are naturally defined in the model as functions on the sets ofreferences undefined on the value null. The object state can be observed or updated by a method thatis a state-dependent function. The result of an updating method is an update set, which is awell-defined mathematical structure. Therefore, the semantics of such a method is given by a set offunctions producing update sets. The state is an implicit parameter for all method declarations andan implicit result for state updating methods, like in Java and other object-oriented pro- gramminglanguages. This also allowed us to make the declaration methods similar to their declarations inJava-like languages. We have shown that our model supports all important aspects of Java-likelanguages, namely, inheritance, overloading, overriding, and late binding. Because of la